CuSize_t testRunner(CuSuite_t *suite){ //remember no of total testsuite runs static CuSize_t cnt = 0; //pre and postfixes of filename of test results static char filename_start[] = "testdetails"; static char filename_end[] = ".txt"; //allocate array to hold concatenated filename char filename[sizeof(filename_start)+sizeof(filename_end)+2]; FILE *file; assert (NULL != suite); //Run suite and output results printf("*** Testrun: %u ***\n", cnt); CuSuiteRun(suite); CuSuiteDetails(suite, stdout/*output*/); printf("*** End of testrun: %u ***\n\n", cnt); //setup filename snprintf(filename, sizeof(filename), "%s%2u%s",filename_start,cnt,filename_end); //check file io errors if (NULL == (file = fopen(filename, "w"))){ printf("fopen error\n"); }else{ CuSuiteDetails(suite, file); fclose(file); }; ++cnt; return CuSuiteGetFailcount(suite);
/* $4762 (02.07.2015) $4747 (using getHeaderAddr and initHeader) $40c2 (compiled with -Or) $3885 (-or switch also on CuString and CuTest) $383f (no register vars) $3854 (using getDataAddr) */ int main(void){ int Nofails; CuSuite_t* suite = NULL; // suite = CuAlloc_requestEarlyTests(); CuSuiteRun(suite); CuSuiteDetails(suite, stdout); Nofails = CuSuiteGetFailcount(suite); CuSuiteDelete(suite); if (Nofails) return Nofails; printf("Registering tests...\n"); printf("Alloc Count before SuiteNew:%u %u %u\n", CuAlloc_getAllocCount(), CuAlloc_getFreeCount(), CuAlloc_getReallocCount()); suite = CuAlloc_requestTests(); printf("Alloc Count after request tests:%u %u %u\n", CuAlloc_getAllocCount(), CuAlloc_getFreeCount(), CuAlloc_getReallocCount());assert(NULL != suite); printf("Running tests...\n"); CuSuiteRun(suite);//This function does not return! CuSuiteDetails(suite, stdout); printf("Alloc Count after SuiteRun:%u %u %u\n", CuAlloc_getAllocCount(), CuAlloc_getFreeCount(), CuAlloc_getReallocCount()); printf("End testing\n"); Nofails = CuSuiteGetFailcount(suite); CuSuiteDelete(suite); printf("Alloc Count after SuiteDelete:%u %u %u\n", CuAlloc_getAllocCount(), CuAlloc_getFreeCount(), CuAlloc_getReallocCount()); assert (0 == CuAlloc_getPendingFrees()); assert (0 == CuAlloc_getPendingFrees()); /* #ifdef __CC65__ printf("CuAlloc total size: $%x", getCuAllocMemSize()); #endif // __CC65__ */ return Nofails;
void TestCuSuiteDetails_SingleFail(CuTest* tc) { CuSuite ts; CuTest tc1, tc2; CuString details; const char* front; const char* back; CuSuiteInit(&ts); CuTestInit(&tc1, "TestPasses", TestPasses); CuTestInit(&tc2, "TestFails", zTestFails); CuStringInit(&details); CuSuiteAdd(&ts, &tc1); CuSuiteAdd(&ts, &tc2); CuSuiteRun(&ts); CuSuiteDetails(&ts, &details); CuAssertTrue(tc, ts.count == 2); CuAssertTrue(tc, ts.failCount == 1); front = "There was 1 failure:\n" "1) TestFails: "; back = "test should fail\n" "\n!!!FAILURES!!!\n" "Runs: 2 Passes: 1 Fails: 1\n"; CuAssertStrEquals(tc, back, details.buffer + strlen(details.buffer) - strlen(back)); details.buffer[strlen(front)] = 0; CuAssertStrEquals(tc, front, details.buffer); }
int RunPreOpenSetterAndGetterTests(CuString *output) { CuSuite *suite = CuSuiteNew("TestPreOpenSetterAndGetter", TestPreOpenSetterAndGetterSuiteSetup, TestPreOpenSetterAndGetterSuiteTeardown); int count; SUITE_ADD_TEST(suite, TestEnvPreOpenSetterAndGetter, TestPreOpenSetterAndGetterTestSetup, TestPreOpenSetterAndGetterTestTeardown); SUITE_ADD_TEST(suite, TestDbPreOpenSetterAndGetter, TestPreOpenSetterAndGetterTestSetup, TestPreOpenSetterAndGetterTestTeardown); SUITE_ADD_TEST(suite, TestMpoolFilePreOpenSetterAndGetter, TestPreOpenSetterAndGetterTestSetup, TestPreOpenSetterAndGetterTestTeardown); SUITE_ADD_TEST(suite, TestSequencePreOpenSetterAndGetter, TestPreOpenSetterAndGetterTestSetup, TestPreOpenSetterAndGetterTestTeardown); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); count = suite->failCount; CuSuiteDelete(suite); return (count); }
int RunPartitionTests(CuString *output) { CuSuite *suite = CuSuiteNew("TestPartition", TestPartitionSuiteSetup, TestPartitionSuiteTeardown); int count; SUITE_ADD_TEST(suite, TestPartOneKeyNoData, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartTwoKeyNoData, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartDuplicatedKey, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartUnsortedKey, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartNumber, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartKeyCallBothSet, TestPartitionTestSetup, TestPartitionTestTeardown); SUITE_ADD_TEST(suite, TestPartKeyCallNeitherSet, TestPartitionTestSetup, TestPartitionTestTeardown); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); count = suite->failCount; CuSuiteDelete(suite); return (count); }
int RunDbHotBackupTests(CuString *output) { CuSuite *suite = CuSuiteNew("TestDbHotBackup", TestDbHotBackupSuiteSetup, TestDbHotBackupSuiteTeardown); int count; SUITE_ADD_TEST(suite, TestBackupSimpleEnvNoCallback, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupSimpleEnvWithCallback, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupSimpleEnvWithConfig, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupPartitionDB, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupMultiDataDir, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupSetLogDir, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupQueueDB, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); SUITE_ADD_TEST(suite, TestBackupHeapDB, TestDbHotBackupTestSetup, TestDbHotBackupTestTeardown); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); count = suite->failCount; CuSuiteDelete(suite); return (count); }
int main(int argc, char *argv[]) { int idx; for (idx = 1; idx < argc; ++idx) { if (strcmp(argv[idx], "--env-file-name") == 0) { printf("envDefault"); return 0; } else { printf("error:\tinvalid option '%s'\n", argv[idx]); return 2; } } /* this is our global suite */ CuSuite *suite = CuSuiteNew(); /* register the functions in the order that we should run them */ CuSuiteAddSuite(suite, GetSuiteTXT()); CuSuiteAddSuite(suite, GetSuiteTXTCompare()); CuSuiteAddSuite(suite, GetSuiteTXTConcat()); /* run them */ CuSuiteRun(suite); /* format our output for the log */ CuString *output = CuStringNew(); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s:\t%s\n", argv[0], output->buffer); /* there's no public interface to the failCount, so cheat * and use the value directly */ return suite->failCount == 0 ? 0 : 2; }
int main (void) { CuString *output = CuStringNew (); CuSuite* suite = CuSuiteNew (); int ret; _p11_mutex_init (&race_mutex); mock_module_init (); _p11_library_init (); #ifdef OS_UNIX SUITE_ADD_TEST (suite, test_fork_initialization); #endif SUITE_ADD_TEST (suite, test_recursive_initialization); SUITE_ADD_TEST (suite, test_threaded_initialization); CuSuiteRun (suite); CuSuiteSummary (suite, output); CuSuiteDetails (suite, output); printf ("%s\n", output->buffer); ret = suite->failCount; CuSuiteDelete (suite); CuStringDelete (output); return ret; }
void TestCuSuiteDetails_MultiplePasses(CuTest* tc) { CuSuite ts; CuTest tc1, tc2; CuString details; const char* expected; CuSuiteInit(&ts); CuTestInit(&tc1, "TestPasses", TestPasses); CuTestInit(&tc2, "TestPasses", TestPasses); CuStringInit(&details); CuSuiteAdd(&ts, &tc1); CuSuiteAdd(&ts, &tc2); CuSuiteRun(&ts); CuSuiteDetails(&ts, &details); CuAssertTrue(tc, ts.count == 2); CuAssertTrue(tc, ts.failCount == 0); expected = "OK (2 tests)\n"; CuAssertStrEquals(tc, expected, details.buffer); }
void RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); SUITE_ADD_TEST(suite, Test_find_decoded_line_length_b4_should_be_four); SUITE_ADD_TEST(suite, Test_find_decoded_line_length_b1000_should_be_one_thousand); SUITE_ADD_TEST(suite, Test_find_decoded_line_length_b502_should_be_502); SUITE_ADD_TEST(suite, Test_string_of_encode); SUITE_ADD_TEST(suite, Test_string_of_encode_with_all_the_same_character); SUITE_ADD_TEST(suite, Test_string_of_encode_with_a_large_number_of_characters); SUITE_ADD_TEST(suite, Test_string_of_encode_with_single_occurrence_characters); SUITE_ADD_TEST(suite, Test_same_character_string_of_decode); SUITE_ADD_TEST(suite, Test_multicharacter_string_of_decode); SUITE_ADD_TEST(suite, Test_140character_string_of_decode); SUITE_ADD_TEST(suite, Test_1character_occurrences_string_of_decode); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuStringDelete(output); CuSuiteDelete(suite); }
void RunAllTests(void) { LOGD("RunAllTests() Entered!\n"); CuString *output = CuStringNew();//Êä³ö½á¹¹Ìå CuSuite* suite = CuSuiteNew();//²âÊÔ×é¾ä±ú CuSuite* suite_test = NULL;//²âÊÔ×é¾ä±ú //Ôö¼ÓµÄ²âÊÔ×é printf("Step1\n"); suite_test = CuGetSuite(); CuSuiteRobSuite(suite, suite_test); CuSuiteDelete(suite_test); printf("Step2\n"); suite_test = CuStringGetSuite(); CuSuiteRobSuite(suite, suite_test); CuSuiteDelete(suite_test); printf("Step3\n"); CuSuiteRun(suite); printf("Step4\n"); CuSuiteSummary(suite, output); printf("Step5\n"); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuSuiteDelete(suite); CuStringDelete(output); }
int main(int argc, char **argv) { CuString *output = CuStringNew(); CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_user_get_uid_retrieves_targetted_user); SUITE_ADD_TEST(suite, test_user_get_uid_does_not_retrieve_invalid_user); SUITE_ADD_TEST(suite, test_user_get_group_gid_retrieves_desired_group); SUITE_ADD_TEST(suite, test_user_get_group_gid_does_not_retrieve_invalid_group); SUITE_ADD_TEST(suite, test_user_is_in_group_true_when_user_in_group); SUITE_ADD_TEST(suite, test_user_is_in_group_false_when_user_not_in_group); SUITE_ADD_TEST(suite, test_user_group_add_succeeds_for_valid_user_group); SUITE_ADD_TEST(suite, test_user_group_add_fails_for_invalid_user); SUITE_ADD_TEST(suite, test_user_groups_retrieves_users_groups); SUITE_ADD_TEST(suite, test_users_in_animal_is_not_null); SUITE_ADD_TEST(suite, test_user_in_animal_returns_two_users_for_first_animal); SUITE_ADD_TEST(suite, test_user_get_record_returns_a_record); SUITE_ADD_TEST(suite, test_user_get_record_returns_requested_user); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount; }
int main(int argc, char* argv[]) { CuSuite* suite = CuSuiteNew(); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnByte")) SUITE_ADD_TEST(suite, testCall0ReturnByte); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnInt")) SUITE_ADD_TEST(suite, testCall0ReturnInt); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnPtr")) SUITE_ADD_TEST(suite, testCall0ReturnPtr); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnLong")) SUITE_ADD_TEST(suite, testCall0ReturnLong); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnFloat")) SUITE_ADD_TEST(suite, testCall0ReturnFloat); if (argc < 2 || !strcmp(argv[1], "testCall0ReturnDouble")) SUITE_ADD_TEST(suite, testCall0ReturnDouble); if (argc < 2 || !strcmp(argv[1], "testCall0OneArgOfEach")) SUITE_ADD_TEST(suite, testCall0OneArgOfEach); if (argc < 2 || !strcmp(argv[1], "testCall0ManyArgsOfEach")) SUITE_ADD_TEST(suite, testCall0ManyArgsOfEach); if (argc < 2 || !strcmp(argv[1], "testCall0Unwind")) SUITE_ADD_TEST(suite, testCall0Unwind); if (argc < 2 || !strcmp(argv[1], "testCall0StackAlignment1")) SUITE_ADD_TEST(suite, testCall0StackAlignment1); if (argc < 2 || !strcmp(argv[1], "testCall0StackAlignment2")) SUITE_ADD_TEST(suite, testCall0StackAlignment2); CuSuiteRun(suite); if (argc < 2) { CuString *output = CuStringNew(); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); } return suite->failCount; }
void RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); SUITE_ADD_TEST(suite, TestInitLL); SUITE_ADD_TEST(suite, TestLengthLL); SUITE_ADD_TEST(suite, TestInsertLLIncreasesLength); SUITE_ADD_TEST(suite, TestInsertLLInserts); SUITE_ADD_TEST(suite, TestCountLL); SUITE_ADD_TEST(suite, TestIndexLL); SUITE_ADD_TEST(suite, TestRemoveLL); SUITE_ADD_TEST(suite, TestExtendLL); SUITE_ADD_TEST(suite, TestLookup); SUITE_ADD_TEST(suite, TestLookup2); SUITE_ADD_TEST(suite, TestLookup3); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuStringDelete(output); CuSuiteDelete(suite); }
int main() { CuSuite *suites[] = { strtrim_get_cusuite(), strrpl_get_cusuite(), iv_parse_config_get_cusuite(), iv_parse_index_get_cusuite(), iv_parse_series_get_cusuite(), iv_parse_auth_get_cusuite(), iv_parse_categories_get_cusuite(), }; CuString *output = CuStringNew(); CuSuite *suite = CuSuiteNew(); unsigned int i; for(i=0; i<SUITE_COUNT(suites); i++) { if(suites[i]) { CuSuiteAddSuite(suite, suites[i]); } /* Hack for CuTest odditiy - CuSuiteAddSuite() implementation copies * tests attached to suites[i] into suite and doesn't internally free * suites[i]. Documentation doesn't mention anything about this. */ free(suites[i]); } CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuSuiteDelete(suite); CuStringDelete(output); return 0; }
int main(void) { char *output = NULL; CuSuite* suite = CuSuiteNew(); abs_top_srcdir = getenv("abs_top_srcdir"); if (abs_top_srcdir == NULL) die("env var abs_top_srcdir must be set"); abs_top_builddir = getenv("abs_top_builddir"); if (abs_top_builddir == NULL) die("env var abs_top_builddir must be set"); if (asprintf(&src_root, "%s/tests/root", abs_top_srcdir) < 0) { die("failed to set src_root"); } CuSuiteSetup(suite, setup, teardown); SUITE_ADD_TEST(suite, testSaveNewFile); SUITE_ADD_TEST(suite, testNonExistentLens); SUITE_ADD_TEST(suite, testMultipleXfm); SUITE_ADD_TEST(suite, testMtime); SUITE_ADD_TEST(suite, testRelPath); CuSuiteRun(suite); CuSuiteSummary(suite, &output); CuSuiteDetails(suite, &output); printf("%s\n", output); free(output); return suite->failCount; }
int halGeneratorAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount > 0; }
void RunTests(CuSuite * suite, const char *name) { CuString *output = CuStringNew(); CuSuiteRun(suite); CuSuiteDetails(suite, output); if (suite->failCount) CuSuiteSummary(suite, output); printf("%s: %s", name, output->buffer); CuStringDelete(output); }
void RunC4Tests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, c4_engine_suite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
int main(){ CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, geometry_get_suite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount; }
int runAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, pathMapperTestSuite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount > 0; }
static int runTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, stKVDatabaseTestSuite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount > 0; }
void run_all_tests(void) { CuString *output = CuStringNew(); CuSuite *suite = CuSuiteNew(); /* CuSuiteAddSuite(suite, test_proxy_request_handler_get_suite()); */ CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
int halMafRunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, halMafExportTestSuite()); CuSuiteAddSuite(suite, halMafBlockTestSuite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); return suite->failCount > 0; }
int main() { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_wcs_shift); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); CuSuiteFree(suite); CuStringFree(output); }
void RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, StrUtilGetSuite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
int main(int argc, const char* args[]) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, em4x05_suite()); CuSuiteAddSuite(suite, ring_buffer_suite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
int main(void) { CuString *output = CuStringNew(); CuSuite *suite = CuSuiteNew(); CuSuiteAddSuite(suite, grid_test_suite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
void RunAllTests(void) { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); //CuSuiteAddSuite(suite, (CuSuite*)daysInMonthGetSuite()); // Adding our test suite CuSuiteAddSuite(suite, (CuSuite*)quadraticSuite()); // Adding our test suite CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }
void RunAllTests() { CuString *output = CuStringNew(); CuSuite* suite = CuSuiteNew(); CuSuiteAddSuite(suite, CHStackPeekGetSuite()); CuSuiteAddSuite(suite, CHStackPushGetSuite()); CuSuiteAddSuite(suite, CHStackPopGetSuite()); CuSuiteRun(suite); CuSuiteSummary(suite, output); CuSuiteDetails(suite, output); printf("%s\n", output->buffer); }