int main(void) { TestMain(); while(1); };
int TestMain () { #if _MSC_VER && !__TBBMALLOC_NO_IMPLICIT_LINKAGE && !__TBB_WIN8UI_SUPPORT #ifdef _DEBUG ASSERT(!GetModuleHandle("tbbmalloc.dll") && GetModuleHandle("tbbmalloc_debug.dll"), "test linked with wrong (non-debug) tbbmalloc library"); #else ASSERT(!GetModuleHandle("tbbmalloc_debug.dll") && GetModuleHandle("tbbmalloc.dll"), "test linked with wrong (debug) tbbmalloc library"); #endif #endif /* _MSC_VER && !__TBBMALLOC_NO_IMPLICIT_LINKAGE */ int result = TestMain<tbb::scalable_allocator<void> >(); { tbb::memory_pool<tbb::scalable_allocator<int> > pool; result += TestMain(tbb::memory_pool_allocator<void>(pool) ); }{ tbb::memory_pool<MinimalAllocator> pool; cnt_alloc_t alloc(( tbb::memory_pool_allocator<char>(pool) )); // double parentheses to avoid function declaration result += TestMain(alloc); }{ static char buf[1024*1024*4]; tbb::fixed_pool pool(buf, sizeof(buf)); const char *text = "this is a test";// 15 bytes char *p1 = (char*)pool.malloc( 16 ); ASSERT(p1, NULL); strcpy(p1, text); char *p2 = (char*)pool.realloc( p1, 15 ); ASSERT( p2 && !strcmp(p2, text), "realloc broke memory" ); result += TestMain(tbb::memory_pool_allocator<void>(pool) ); // try allocate almost entire buf keeping some reasonable space for internals char *p3 = (char*)pool.realloc( p2, sizeof(buf)-128*1024 ); ASSERT( p3, "defragmentation failed" ); ASSERT( !strcmp(p3, text), "realloc broke memory" ); for( size_t sz = 10; sz < sizeof(buf); sz *= 2) { ASSERT( pool.malloc( sz ), NULL); pool.recycle(); } result += TestMain(tbb::memory_pool_allocator<void>(pool) ); } TestSmallFixedSizePool(); TestZeroSpaceMemoryPool(); ASSERT( !result, NULL ); return Harness::Done; }
int main(void) { // // Do the main test // TestMain(); while(1); }
/* * Main entry point */ int main(int argc, char *argv[], char *argp[]) { #ifdef WIN32 #ifdef _DEBUG _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF #ifdef DEBUG_CRTMEMLEAKS | _CRTDBG_CHECK_CRT_DF | _CRTDBG_CHECK_ALWAYS_DF #endif ); #endif #endif Util::Init(); g_ArgumentCount = argc; g_Arguments = (char*(*)[])argv; g_EnvironmentVariables = (char*(*)[])argp; if (argc > 1 && (!strcmp(argv[1], "-tests") || !strcmp(argv[1], "--tests"))) { #ifdef ENABLE_TESTS return TestMain(argc, argv); #else printf("ERROR: Could not start tests, the program was compiled without tests\n"); return 1; #endif } #ifdef ENABLE_TESTS TestCleanup(); #endif #ifdef WIN32 InstallUninstallServiceCheck(argc, argv); #endif srand(Util::CurrentTime()); #ifdef WIN32 for (int i=0; i < argc; i++) { if (!strcmp(argv[i], "-D")) { StartService(RunMain); return 0; } } #endif RunMain(); return 0; }
BOOL WinTestRunnerApp::InitInstance() { AllocConsole(); SetConsoleTitle("CppUnit WinTestRunner Console"); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); freopen("CONIN$", "r", stdin); TestMain(); FreeConsole(); return FALSE; }
int main(int argc, char* argv[]) { return TestMain(argc, argv); }
/////////////////////////////////////////////// // // // 主函数入口 // // /////////////////////////////////////////////// void func() { printf("开始运行程序...\n"); TestMain(); printf("程序运行完成...\n"); }