/* * 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; }
void WithSetup(Handler handler) { JsRuntimeHandle runtime = JS_INVALID_RUNTIME_HANDLE; if (!TestSetup(&runtime)) { REQUIRE(false); return; } handler(runtime); TestCleanup(runtime); }
static void Check2(int aValue, int aExpected, int aLine) { if(aValue != aExpected) { if(TheDb2) { const char* errmsg = sqlite3_errmsg(TheDb2); PrintS("*** SQLITE error message: %s\r\n", errmsg); } TestCleanup(); PrintIII("*** Test check failed! Line=%d. Expected error: %d, got: %d\r\n", aLine, aExpected, aValue); TestAbort(aLine); } }
static void Check1(int aValue, int aLine) { if(!aValue) { if(TheDb2) { const char* errmsg = sqlite3_errmsg(TheDb2); PrintS("*** SQLITE error message: %s\r\n", errmsg); } TestCleanup(); PrintI("*** Test check failed! Line=%d\r\n", aLine); TestAbort(aLine); } }
int main(int argc, char *argv[]) { /* Initialize testing framework */ TestInit(argv[0], NULL, NULL); /* Tests are generally arranged from least to most complexity... */ AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL); AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code", NULL); AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL); AddTest("heap", test_heap, NULL, "Memory Heaps", NULL); AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL); AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL); AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL); AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); AddTest("coords", test_coords, cleanup_coords, "Dataspace coordinates", NULL); AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL); AddTest("select", test_select, cleanup_select, "Selections", NULL); AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); AddTest("reference", test_reference, cleanup_reference, "References", NULL); AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL); AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL); /* Display testing information */ TestInfo(argv[0]); /* Parse command line arguments */ TestParseCmdLine(argc,argv); /* Perform requested testing */ PerformTests(); /* Display test summary, if requested */ if (GetTestSummary()) TestSummary(); /* Clean up test files, if allowed */ if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) TestCleanup(); return (GetTestNumErrs()); } /* end main() */