int gsb_cunit_run_tests() { /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ if ( ( NULL == gsb_data_account_cunit_create_suite ( ) ) || ( NULL == gsb_real_cunit_create_suite ( ) ) || ( NULL == utils_dates_cunit_create_suite ( ) ) || ( NULL == utils_real_cunit_create_suite ( ) ) ) { CU_cleanup_registry(); return CU_get_error(); } /* Run all tests */ #ifdef _WIN32 CU_automated_run_tests(); #else /* _WIN32 */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); #endif /* _WIN32 */ CU_cleanup_registry(); return CU_get_error(); }
int main() { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ /* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */ if ( (NULL == CU_add_test(pSuite, "test of init args", test_init_args)) || (NULL == CU_add_test(pSuite, "test of term args", test_term_args)) ) { CU_cleanup_registry(); return CU_get_error(); } /* Run all tests using the CUnit Basic interface */ CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main(int argc, char *argv[]) { CU_ErrorCode cu; CU_pSuite suite; const char *configpath, *mode = NULL; if (argc < 2) { fprintf(stderr, "please gives a configuration file\n"); exit(-1); } cu = CU_initialize_registry(); if (cu != CUE_SUCCESS) { fprintf(stderr, "error cunit initialization: %s\n", CU_get_error_msg()); exit(-1); } configpath = argv[1]; if (argc > 2) mode = argv[2]; if (da_cloud_init(&config, configpath) == 0) { suite = CU_add_suite("da_cloud", NULL, NULL); CU_add_test(suite, "da_cloud_headers_test", da_cloud_headers_test); CU_add_test(suite, "da_cloud_simple_lookup", da_cloud_simple_lookup); CU_add_test(suite, "da_cloud_properties_test", da_cloud_properties_test); if (mode != NULL && strcasecmp(mode, "show") == 0) CU_basic_run_tests(); else CU_automated_run_tests(); } da_cloud_fini(&config); CU_cleanup_registry(); return (0); }
int main() { CU_pSuite pSuite = NULL; int err_code; /* initialize the CUnit test registry */ err_code = CU_initialize_registry(); if (err_code != CUE_SUCCESS) { return CU_get_error(); } /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", dummy, dummy); if (pSuite == NULL) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ /* NOTE - ORDER IS IMPORTANT - MUST TEST fread() AFTER fprintf() */ CU_pTest errt; errt = CU_add_test(pSuite, "test seat", test_seat); if (errt == NULL) { return CU_get_error(); } /* Run all tests using the CUnit Basic interface */ //CU_basic_set_mode(CU_BRM_VERBOSE); CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main (int argc, char** argv) { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", setup, teardown); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ if (NULL == CU_add_test(pSuite, "List Creation Test", test_linkedList_create) || NULL == CU_add_test(pSuite, "List Add Test", test_linkedList_add) || NULL == CU_add_test(pSuite, "List Remove Test", test_linkedList_remove)) { CU_cleanup_registry(); return CU_get_error(); } CU_set_output_filename(argv[1]); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main(int argc, char **argv) { int status; if(CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); if(!(status = setup_object_tests()) || !(status = setup_list_tests())) { CU_cleanup_registry(); return CU_get_error(); } CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); printf("\n"); CU_basic_show_failures(CU_get_failure_list()); printf("\n\n"); CU_automated_run_tests(); CU_list_tests_to_file(); //CU_console_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main(void) { CU_pSuite pSuite1 = NULL; if (CUE_SUCCESS != CU_initialize_registry()) { fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } pSuite1 = CU_add_suite("Suite_1", NULL, NULL); if (NULL == pSuite1) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "some test", test1)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } /* TODO: set output file */ CU_automated_run_tests(); CU_cleanup_registry(); return 0; }
void TcuExecute(void) { if (TestGetAutomatic()) { if (TestGetFilename()) { CU_set_output_filename(TestGetFilename()); } CU_automated_run_tests(); } else if (TestGetBasic()) { CU_basic_set_mode(CU_BRM_VERBOSE); (void) CU_basic_run_tests(); } else if (TestGetConsole()) { CU_console_run_tests(); } else if (TestGetList()) { if (TestGetFilename()) { CU_set_output_filename(TestGetFilename()); } (void) CU_list_tests_to_file(); } if (CU_get_number_of_tests_failed()) { return; } /* Clean up the registry */ CU_cleanup_registry(); }
int main() { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("malELFicus Test Suite", init_suite_success, clean_suite_success); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ if ( (NULL == CU_add_test(pSuite, "testing malelf_init_object()", test_malelf_init_object)) || (NULL == CU_add_test(pSuite, "testing malelf_openr", test_malelf_openr)) || (NULL == CU_add_test(pSuite, "testing malelf_openw", test_malelf_openw)) || (NULL == CU_add_test(pSuite, "testing malelf_check_elf", test_malelf_check_elf)) ) { CU_cleanup_registry(); return CU_get_error(); } CU_set_output_filename("test_malelf_object"); /* Run all tests using the automated interface */ CU_automated_run_tests(); CU_list_tests_to_file(); /* Clean up registry and return */ CU_cleanup_registry(); return CU_get_error(); }
int main(char** args) { // En cas de problème de la librairie, le programme de test s'arrete et affiche un message (par exemple : memory allocation failed). CU_set_error_action(CUEA_ABORT) ; // Initialisation printf("Initialisation des tests.\n") ; CU_initialize_registry() ; init_suites() ; // Lancement printf("Lancement des tests.\n") ; // Variante 1 : fabriquer un fichier XML CU_automated_run_tests() ; printf("Pour observer les resultats, ouvrir le fichier .xml dans firefox\n") ; printf("Copier le fichier de style dans le meme repertoire : \n") ; printf("cp /usr/local/share/CUnit/CUnit-Run.xsl .\n\n") ; // Variante 2 : interface interactive dans le terminal. //CU_curses_run_tests() ; CU_basic_run_tests(); // Nettoyage final CU_cleanup_registry() ; }
int main(int argc, char *argv[]) { int basic; int console; int automated; /* parse the command line options */ while ((c = getopt(argc, argv, "abc")) != -1) { switch (c) { case 'a': /* basic mode */ basic = 1; break; case 'b': /* basic mode */ basic = 1; break; case 'c': /* run from command line */ console = 1; break; default: /* error, print usage */ usage(argv[0]); return -1; } } if (CU_initialize_registry()) { fprintf(stderr, "\nInitialization of Test Registry failed.\n"); exit(EXIT_FAILURE); } else { AddTests(); // set up the run mode and run the tests if (automated) { CU_set_output_filename("TestOutput.xml"); CU_list_tests_to_file(); CU_automated_run_tests(); } else if (basic) { CU_BasicRunMode mode = CU_BRM_VERBOSE; CU_ErrorAction error_action = CUEA_IGNORE; CU_basic_set_mode(mode); CU_set_error_action(error_action); CU_basic_run_tests(); } else if (console) { CU_console_run_tests(); } CU_cleanup_registry(); } return 0; }
int main(int argc, char** argv) { CU_pSuite pSuite = NULL; int xml = 0, i; for(i=1; i < argc; i++) { if (strcmp(argv[i], "--xml") == 0 || strcmp(argv[i], "-x") == 0) xml = 1; } /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", InitTestSuite, CleanTestSuite); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ // WANIPConn1 tests if ((NULL == CU_add_test(pSuite, "test of RetrieveListOfPortMappings()", Test_RetrieveListOfPortMappings)) || (NULL == CU_add_test(pSuite, "test of GetSpecificPortMappingEntry()", Test_GetSpecificPortMappingEntry)) || (NULL == CU_add_test(pSuite, "test of AddPortMapping()", Test_AddPortMapping)) || (NULL == CU_add_test(pSuite, "test of DeletePortMapping()", Test_DeletePortMapping)) || (NULL == CU_add_test(pSuite, "test of DeletePortMappingRange()", Test_DeletePortMappingRange)) || (NULL == CU_add_test(pSuite, "test of Test_ControlPointIP_equals_InternalClientIP()", Test_ControlPointIP_equals_InternalClientIP)) || (NULL == CU_add_test(pSuite, "test of AddAnyPortMapping()", Test_AddAnyPortMapping))) { CU_cleanup_registry(); return CU_get_error(); } // WANEthLinkC1 tests if ((NULL == CU_add_test(pSuite, "test of GetEthernetLinkStatus()", Test_GetEthernetLinkStatus))) { CU_cleanup_registry(); return CU_get_error(); } if (xml) { CU_automated_run_tests(); } else { CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); } CU_cleanup_registry(); return CU_get_error(); }
int main(int argc, char** argv) { CU_pFailureRecord FailureList; CU_RunSummary *pRunSummary; int FailRec; if(CU_initialize_registry()) { fprintf(stderr, "Initialization of Test Registry failed.'n"); return -1; } assert(CU_get_registry()); assert(!CU_is_test_running()); if(CU_register_suites(suites) != CUE_SUCCESS) { fprintf(stderr, "Register suites failed - %s\n", CU_get_error_msg()); return -1; } CU_set_output_filename("lib-c"); CU_list_tests_to_file(); CU_automated_run_tests(); pRunSummary = CU_get_run_summary(); printf("Results:\n"); printf(" Number of suites run: %d\n", pRunSummary->nSuitesRun); printf(" Number of suites failed: %d\n", pRunSummary->nSuitesFailed); printf(" Number of tests run: %d\n", pRunSummary->nTestsRun); printf(" Number of tests failed: %d\n", pRunSummary->nTestsFailed); printf(" Number of asserts: %d\n", pRunSummary->nAsserts); printf(" Number of asserts failed: %d\n", pRunSummary->nAssertsFailed); printf(" Number of failures: %d\n", pRunSummary->nFailureRecords); /* Print any failures */ if (pRunSummary->nFailureRecords) { printf("\nFailures:\n"); FailRec = 1; for (FailureList = CU_get_failure_list(); FailureList; FailureList = FailureList->pNext) { printf("%d. File: %s Line: %u Test: %s\n", FailRec, FailureList->strFileName, FailureList->uiLineNumber, (FailureList->pTest)->pName); printf(" %s\n", FailureList->strCondition); FailRec++; } printf("\n"); } CU_cleanup_registry(); return 0; }
/* * Main */ int main(void) { CU_pSuite ptr_suite = NULL; int nr_of_failed_tests = 0; int nr_of_failed_suites = 0; /* Initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ ptr_suite = CU_add_suite("ofp port config", init_suite, clean_suite); if (NULL == ptr_suite) { CU_cleanup_registry(); return CU_get_error(); } if (NULL == CU_ADD_TEST(ptr_suite, test_sinlge_port_basic)) { CU_cleanup_registry(); return CU_get_error(); } if (NULL == CU_ADD_TEST(ptr_suite, test_two_ports_vlan)) { CU_cleanup_registry(); return CU_get_error(); } if (NULL == CU_ADD_TEST(ptr_suite, test_gre_port)) { CU_cleanup_registry(); return CU_get_error(); } #if OFP_TESTMODE_AUTO CU_set_output_filename("CUnit-Port-conf"); CU_automated_run_tests(); #else /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); #endif nr_of_failed_tests = CU_get_number_of_tests_failed(); nr_of_failed_suites = CU_get_number_of_suites_failed(); CU_cleanup_registry(); return (nr_of_failed_suites > 0 ? nr_of_failed_suites : nr_of_failed_tests); }
int main( int argc, char *argv[] ) { if(CU_initialize_registry()) { fprintf(stderr, " Initialization of Test Registry failed. "); exit(EXIT_FAILURE); }else{ AddTests(); CU_set_output_filename("Test single"); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); } return 0; }
int automatedTest(int argc, char* argv[]) { CU_BOOL Run = CU_FALSE ; setvbuf(stdout, NULL, _IONBF, 0); if (argc > 1) { if (!strcmp("-i", argv[1])) { Run = CU_TRUE ; CU_set_error_action(CUEA_IGNORE); } else if (!strcmp("-f", argv[1])) { Run = CU_TRUE ; CU_set_error_action(CUEA_FAIL); } else if (!strcmp("-A", argv[1])) { Run = CU_TRUE ; CU_set_error_action(CUEA_ABORT); } // else if (!strcmp("-e", argv[1])) { // print_example_results(); // } else { printf("\nUsage: AutomatedTest [option]\n\n" " Options: -i Run, ignoring framework errors [default].\n" " -f Run, failing on framework error.\n" " -A Run, aborting on framework error.\n" // " -e Print expected test results and exit.\n" " -h Print this message.\n\n"); } } else { Run = CU_TRUE; CU_set_error_action(CUEA_IGNORE); } if (CU_TRUE == Run) { if (CU_initialize_registry()) { printf("\nInitialization of Test Registry failed."); } else { AddTests(); CU_set_output_filename("TestAutomated"); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); } } return 0; }
int main (void) { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite1", init_suite1, clean_suite1); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ if ((NULL == CU_add_test(pSuite, " 1: Requesting a single record in a compressed warc file", test1)) || (NULL == CU_add_test(pSuite, " 2: Requesting a whole warc file", test2)) || (NULL == CU_add_test(pSuite, " 3: sending a bad request", test3)) || (NULL == CU_add_test(pSuite," 4: sending a filter request", test4)) || (NULL == CU_add_test(pSuite," 5: sending a List request with severral output format", test5))) { CU_cleanup_registry(); return CU_get_error(); } /* Run all tests using the automated interface*/ switch (menu()) { case 1: {CU_console_run_tests(); break;} case 2: { case 21: {CU_basic_set_mode(CU_BRM_NORMAL); CU_basic_run_tests(); break;} case 22:{CU_basic_set_mode(CU_BRM_VERBOSE ); CU_basic_run_tests(); break;} case 23:{CU_basic_set_mode(CU_BRM_SILENT); CU_basic_run_tests(); break;} } case 3:{ CU_set_output_filename("./utest/outputs/client"); CU_set_output_filename("./utest/outputs/client" ); CU_automated_run_tests(); CU_list_tests_to_file(); break;} } CU_cleanup_registry(); return CU_get_error(); }
return; } } void contact_provider_test_run() { if (CU_initialize_registry()) { return; } else { contact_provider_add_tests(); CU_set_output_filename("contact_provider_test_output"); CU_list_tests_to_file();
int main() { if (CU_initialize_registry()) { printf("\nInitialization of Test Registry failed."); }else{ LOG_FILE_OPEN("log.txt"); AddTests(); /*******Automated Mode(best)********************* * CU_set_output_filename("TestAutomated"); * CU_list_tests_to_file(); * CU_automated_run_tests(); ******************************************/ CU_set_output_filename("TestAutomated"); CU_list_tests_to_file(); CU_automated_run_tests(); /*******Basic Mode********************* * mode can choose: * typedef enum { * CU_BRM_NORMAL = 0, Normal mode - failures and run summary are printed [default]. * CU_BRM_SILENT, Silent mode - no output is printed except framework error messages. * CU_BRM_VERBOSE Verbose mode - maximum output of run details. * } CU_BasicRunMode; **************************************** * * CU_basic_set_mode(CU_BRM_NORMAL); * CU_basic_run_tests(); ******************************************/ /*******Console Mode********************* * CU_console_run_tests(); ******************************************/ /*******Curses Mode********************* * CU_curses_run_tests(); ******************************************/ CU_cleanup_registry(); } LOG_FILE_CLOSE(); return 0; }
int main(void) { CU_initialize_registry(); suite_Utility(); suite_CcnClient(); suite_SeqNum(); suite_NdnlpPkt(); suite_MsgSlicer(); suite_PartialMsg(); suite_SentPkt(); suite_Link(); CU_automated_run_tests(); CU_list_tests_to_file(); CU_cleanup_registry(); return 0; }
int main( int argc, char *argv[] ) { printf("test start\n"); if(CU_initialize_registry()){ fprintf(stderr, "\nInitialization of Test Registry failed.\n"); exit(EXIT_FAILURE); }else{ AddTests(); CU_set_output_filename("ununpack"); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); } printf("end\n"); return 0; }
/* * Set up and run tests. * * @return CUE_SUCCESS if successful, else a CUnit error code if * any problems arise. */ int main() { if (CUE_SUCCESS != CU_initialize_registry()) { return CU_get_error(); } CU_pSuite suite = CU_add_suite("Fibonacci Suite", initialise_suite, cleanup_suite); if (NULL == suite) { CU_cleanup_registry(); return CU_get_error(); } if ((NULL == CU_add_test(suite, "test_fibonacci_1", test_fibonacci_1)) || (NULL == CU_add_test(suite, "test_fibonacci_2", test_fibonacci_2)) || (NULL == CU_add_test(suite, "test_fibonacci_3", test_fibonacci_3)) || (NULL == CU_add_test(suite, "test_fibonacci_30", test_fibonacci_30))) { CU_cleanup_registry(); return CU_get_error(); } // Run all tests using CUnit Basic interface which outputs // results to command-line. CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); // Run all tests using CUnit Automated interface which outputs // results to a file, default name CUnitAutomated-Results.xml. // DTD CUnit-Run.dtd and and XSL stylesheet CUnit-Run.xsl in Share/ // Uncomment this line to override default output file prefix. // CU_set_output_filename("Test"); CU_list_tests_to_file(); // Output listing of tests in suites to a file, default name // CUnitAutomated-Listing.xml // DTD CUnit-List.dtd and and XSL stylesheet CUnit-List.xsl in Share/ CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main(void) { CU_pSuite pSuite1 = NULL; if (CUE_SUCCESS != CU_initialize_registry()) { fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } pSuite1 = CU_add_suite("Greater than Null", NULL, NULL); if (NULL == pSuite1) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "Test positive numbers", test_positive_numbers)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "Test zero", test_zero)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "Test negative numbers", test_negative_numbers)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } CU_automated_run_tests(); CU_cleanup_registry(); return 0; }
int main (int argc, char** argv) { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", setup, NULL); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ if (NULL == CU_add_test(pSuite, "Map Creation Test", test_hashMap_create) || NULL == CU_add_test(pSuite, "Map Size Test", test_hashMap_size) || NULL == CU_add_test(pSuite, "Map Is Empty Test", test_hashMap_isEmpty) || NULL == CU_add_test(pSuite, "Map Get Test", test_hashMap_get) || NULL == CU_add_test(pSuite, "Map Contains Key Test", test_hashMap_containsKey) || NULL == CU_add_test(pSuite, "Map Get Entry Test", test_hashMap_getEntry) || NULL == CU_add_test(pSuite, "Map Put Test", test_hashMap_put) || NULL == CU_add_test(pSuite, "Map Resize Test", test_hashMap_resize) || NULL == CU_add_test(pSuite, "Map Remove Test", test_hashMap_remove) || NULL == CU_add_test(pSuite, "Map Remove Mapping Test", test_hashMap_removeMapping) || NULL == CU_add_test(pSuite, "Map Clear Test", test_hashMap_clear) || NULL == CU_add_test(pSuite, "Map Contains Value Test", test_hashMap_containsValue) || NULL == CU_add_test(pSuite, "Map To Array Test", test_hashMapValues_toArray) ) { CU_cleanup_registry(); return CU_get_error(); } CU_set_output_filename(argv[1]); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main() { if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); CU_ErrorCode error = CU_register_suites(skiplist_suites); if( error != CUE_SUCCESS ) fprintf(stderr, "wtf!"); CU_automated_run_tests(); fprintf(stdout, "%d\n", CU_get_error()); CU_cleanup_registry(); return CU_get_error(); }
int main(int argc, char **argv) { /* 初始化CUnit框架 */ if(CU_initialize_registry()){ fprintf(stderr, " Initialization of Test Registry failed\n"); exit(EXIT_FAILURE); } /* 添加测试suite和test */ /* ------------------ 需要添加修改 ------------------------ */ test_maxi_AddSuites(); test_mini_AddSuites(); /* -------------------------------------------------------- */ /* 设置输出模式 start */ #if 0 // Automated CU_set_output_filename("TestMax"); CU_list_tests_to_file(); CU_automated_run_tests(); #endif #if 1 //basic CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); #endif #if 0 //Console CU_console_run_tests(); #endif #if 0 // Curses CU_curses_run_tests(); #endif /* 设置输出接口 end */ /* 清理CUnit框架 */ CU_cleanup_registry(); return 0; }
int main(void) { CU_pSuite ptr_suite = NULL; int nr_of_failed_tests = 0; int nr_of_failed_suites = 0; /* Initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ ptr_suite = CU_add_suite("ofp errno", init_suite, NULL); if (NULL == ptr_suite) { CU_cleanup_registry(); return CU_get_error(); } if (NULL == CU_ADD_TEST(ptr_suite, test_strerrno)) { CU_cleanup_registry(); return CU_get_error(); } if (NULL == CU_ADD_TEST(ptr_suite, test_tls_errno)) { CU_cleanup_registry(); return CU_get_error(); } #if defined(OFP_TESTMODE_AUTO) CU_set_output_filename("CUnit-Util"); CU_automated_run_tests(); #else /* Run all tests using the CUnit Basic interface */ CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); #endif nr_of_failed_tests = CU_get_number_of_tests_failed(); nr_of_failed_suites = CU_get_number_of_suites_failed(); CU_cleanup_registry(); return (nr_of_failed_suites > 0 ? nr_of_failed_suites : nr_of_failed_tests); }
int main (int argc, char** argv) { CU_pSuite pSuite = NULL; /* initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); /* add a suite to the registry */ pSuite = CU_add_suite("Suite_1", setup, NULL); if (NULL == pSuite) { CU_cleanup_registry(); return CU_get_error(); } /* add the tests to the suite */ if (NULL == CU_add_test(pSuite, "Array List Creation Test", test_arrayList_create) || NULL == CU_add_test(pSuite, "Array List Trim Test", test_arrayList_trimToSize) || NULL == CU_add_test(pSuite, "Array List Capacity Test", test_arrayList_ensureCapacity) || NULL == CU_add_test(pSuite, "Array List Size Test", test_arrayList_size) || NULL == CU_add_test(pSuite, "Array List Is Empty Test", test_arrayList_isEmpty) || NULL == CU_add_test(pSuite, "Array List Contains Test", test_arrayList_contains) || NULL == CU_add_test(pSuite, "Array List Index Of Test", test_arrayList_indexOf) || NULL == CU_add_test(pSuite, "Array List Get Test", test_arrayList_get) || NULL == CU_add_test(pSuite, "Array List Set Test", test_arrayList_set) || NULL == CU_add_test(pSuite, "Array List Add Test", test_arrayList_add) || NULL == CU_add_test(pSuite, "Array List Remove Test", test_arrayList_remove) || NULL == CU_add_test(pSuite, "Array List Remove Element Test", test_arrayList_removeElement) || NULL == CU_add_test(pSuite, "Array List Clear Test", test_arrayList_clear) || NULL == CU_add_test(pSuite, "Array List Add All", test_arrayList_addAll) ) { CU_cleanup_registry(); return CU_get_error(); } CU_set_output_filename(argv[1]); CU_list_tests_to_file(); CU_automated_run_tests(); CU_cleanup_registry(); return CU_get_error(); }
int main(void) { CU_pSuite pSuite1 = NULL; if (CUE_SUCCESS != CU_initialize_registry()) { fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } pSuite1 = CU_add_suite("Palindrom check", NULL, NULL); if (NULL == pSuite1) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "Test string that are a palindrom", test_real_palindroms)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } if (NULL == CU_add_test(pSuite1, "Test string that are not a palindrom", test_false_palindroms)) { CU_cleanup_registry(); fprintf(stderr, "%s", CU_get_error_msg()); exit(-1); } CU_automated_run_tests(); CU_cleanup_registry(); return 0; }
int main( int argc, char *argv[] ) { int failed = 0; gtk_set_locale (); gtk_init (&argc, &argv); if( CU_initialize_registry() ) { g_critical( "Initialization of Test Registry failed." ); return EXIT_FAILURE; } register_all_tests(); CU_set_output_filename( "TestsResult" ); CU_list_tests_to_file(); CU_automated_run_tests(); /*CU_console_run_tests();*/ failed = CU_get_number_of_tests_failed(); CU_cleanup_registry(); if( failed == 0 ) return EXIT_SUCCESS; return EXIT_FAILURE; }