TEST(UnityCommandOptions, GroupFilterReallyFilters) { _U_UINT saved = Unity.NumberOfTests; TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(4, unknownCommand)); UnityIgnoreTest(NULL, "non-matching", NULL); TEST_ASSERT_EQUAL(saved, Unity.NumberOfTests); }
TEST(UnityCommandOptions, UnknownCommandIsIgnored) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(9, unknownCommand)); TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); STRCMP_EQUAL("testname", UnityFixture.NameFilter); TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); }
TEST(UnityCommandOptions, MultipleOptions) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); STRCMP_EQUAL("testname", UnityFixture.NameFilter); TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); }
TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); STRCMP_EQUAL("tttt", UnityFixture.NameFilter); TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); }
TEST(UnityCommandOptions, DefaultOptions) { UnityGetCommandLineOptions(1, noOptions); TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); }
int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)) { int result = UnityGetCommandLineOptions(argc, argv); unsigned int r; if (result != 0) return result; for (r = 0; r < UnityFixture.RepeatCount; r++) { UnityBegin(argv[0]); announceTestRun(r); runAllTests(); UNITY_OUTPUT_CHAR('\n'); UnityEnd(); } return UnityFailureCount(); }
int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)) { int result = UnityGetCommandLineOptions(argc, argv); unsigned int r; if (result != 0) return result; for (r = 0; r < UnityFixture.RepeatCount; r++) { UnityBegin(argv[0]); announceTestRun(r); runAllTests(); if (!UnityFixture.Verbose) UNITY_PRINT_EOL(); UnityEnd(); } return (int)Unity.TestFailures; }
int UnityMain(int argc, char* argv[], void (*runAllTests)(struct _Unity * const unity_p), struct _Unity * const unity_p) { int result = UnityGetCommandLineOptions(argc, argv, unity_p); unsigned int r; if (result != 0) return result; for (r = 0; r < unity_p->RepeatCount; r++) { announceTestRun(r, unity_p); UnityBegin(unity_p); runAllTests(unity_p); UNITY_OUTPUT_CHAR('\n'); UnityEnd(unity_p); } return UnityFailureCount(unity_p); }
TEST(UnityCommandOptions, GroupOrNameFilterWithoutStringFails) { TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(3, unknownCommand)); TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(5, unknownCommand)); TEST_ASSERT_EQUAL(1, UnityMain(3, unknownCommand, NULL)); }
TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); }
TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); }
TEST(UnityCommandOptions, OptionSelectTestByName) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); STRCMP_EQUAL("testname", UnityFixture.NameFilter); }
TEST(UnityCommandOptions, OptionSelectTestByGroup) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); }
TEST(UnityCommandOptions, OptionVerbose) { TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); }