本文整理匯總了C++中CuSuiteDetails函數的典型用法代碼示例。如果您正苦於以下問題:C++ CuSuiteDetails函數的具體用法?C++ CuSuiteDetails怎麽用?C++ CuSuiteDetails使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CuSuiteDetails函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: testRunner
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);
示例2: main
/*
$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;
示例3: TestCuSuiteDetails_SingleFail
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);
}
示例4: RunPreOpenSetterAndGetterTests
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);
}
示例5: RunPartitionTests
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);
}
示例6: RunDbHotBackupTests
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);
}
示例7: main
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;
}
示例8: main
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;
}
示例9: TestCuSuiteDetails_MultiplePasses
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);
}
示例10: RunAllTests
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);
}
示例11: RunAllTests
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);
}
示例12: main
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;
}
示例13: main
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;
}
示例14: RunAllTests
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);
}
示例15: main
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;
}