diff --git a/lib/AceUnit_AbortRunner_Test.c b/lib/AceUnit_AbortRunner_Test.c index c175af8..7f9a653 100644 --- a/lib/AceUnit_AbortRunner_Test.c +++ b/lib/AceUnit_AbortRunner_Test.c @@ -2,29 +2,18 @@ #include #include -bool ran_tc_ok = false; +bool ran_test_failing = false; +bool ran_test_ok = false; -void tc_failing(void) { +void test_failing(void) { + ran_test_failing = true; assert(false); } -void tc_ok(void) { - ran_tc_ok = true; +void test_ok(void) { + ran_test_ok = true; } -static const aceunit_func_t failing_test[] = { - tc_failing, - tc_ok, - NULL, -}; - -const AceUnit_Fixture_t failing_test_fixture = { NULL, NULL, NULL, NULL, failing_test }; - -const AceUnit_Fixture_t *fixtures[] = { - &failing_test_fixture, - NULL, -}; - int main(void) { #if defined(__BCC__) AceUnit_Result_t result; @@ -35,9 +24,12 @@ int main(void) { AceUnit_Result_t result = { 0, 0, 0 }; #endif AceUnit_run(fixtures, &result); +#undef assert #include assert(result.testCaseCount == 2); assert(result.successCount == 1); assert(result.failureCount == 1); + assert(ran_test_failing); + assert(ran_test_ok); return EXIT_SUCCESS; } diff --git a/lib/AceUnit_ForkRunner_Test.c b/lib/AceUnit_ForkRunner_Test.c index e6e3d75..0f0614d 100644 --- a/lib/AceUnit_ForkRunner_Test.c +++ b/lib/AceUnit_ForkRunner_Test.c @@ -2,28 +2,18 @@ #include #include -bool ran_tc_ok = false; +bool ran_test_failing = false; +bool ran_test_ok = false; -void tc_failing(void) { +void test_failing(void) { + ran_test_failing = true; assert(false); } -void tc_ok(void) { - ran_tc_ok = true; +void test_ok(void) { + ran_test_ok = true; } -static const aceunit_func_t failing_test[] = { - tc_failing, - tc_ok, - NULL, -}; - -const AceUnit_Fixture_t failing_test_fixture = { NULL, NULL, NULL, NULL, failing_test }; -const AceUnit_Fixture_t *fixtures[] = { - &failing_test_fixture, - NULL, -}; - int main(void) { #if defined(__BCC__) AceUnit_Result_t result; @@ -34,9 +24,13 @@ int main(void) { AceUnit_Result_t result = { 0, 0, 0 }; #endif AceUnit_run(fixtures, &result); +#undef assert #include assert(result.testCaseCount == 2); assert(result.successCount == 1); assert(result.failureCount == 1); + // Do not assert these, they're modified in a child process, not here. + //assert(ran_test_failing); + //assert(ran_test_ok); return EXIT_SUCCESS; } diff --git a/lib/AceUnit_SetJmpRunner_Test.c b/lib/AceUnit_SetJmpRunner_Test.c index e3e1512..7279892 100644 --- a/lib/AceUnit_SetJmpRunner_Test.c +++ b/lib/AceUnit_SetJmpRunner_Test.c @@ -4,18 +4,18 @@ extern jmp_buf *AceUnit_env; -bool ran_tc_ok = false; +bool ran_test_failing = false; +bool ran_test_ok = false; void test_failing(void) { + ran_test_failing = true; assert(false); } void test_ok(void) { - ran_tc_ok = true; + ran_test_ok = true; } -#undef assert -#include int main(void) { #if defined(__BCC__) AceUnit_Result_t result; @@ -26,8 +26,12 @@ int main(void) { AceUnit_Result_t result = { 0, 0, 0 }; #endif AceUnit_run(fixtures, &result); +#undef assert +#include assert(result.testCaseCount == 2); assert(result.successCount == 1); assert(result.failureCount == 1); + assert(ran_test_failing); + assert(ran_test_ok); return EXIT_SUCCESS; } diff --git a/lib/Makefile b/lib/Makefile index 2ad6d31..3932f65 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -48,8 +48,8 @@ test_SetJmpRunner: AceUnit_SetJmpRunner_Test ./AceUnit_SetJmpRunner_Test AceUnit_SimpleRunner_Test: AceUnit_SimpleRunner_Test.o libaceunit-simple.a -AceUnit_AbortRunner_Test: AceUnit_AbortRunner_Test.o libaceunit-abort.a -AceUnit_ForkRunner_Test: AceUnit_ForkRunner_Test.o libaceunit-fork.a +AceUnit_AbortRunner_Test: AceUnit_AbortRunner_Test.o AceUnit_AbortRunner_Fixture.o libaceunit-abort.a +AceUnit_ForkRunner_Test: AceUnit_ForkRunner_Test.o AceUnit_ForkRunner_Fixture.o libaceunit-fork.a AceUnit_SetJmpRunner_Test: AceUnit_SetJmpRunner_Test.o AceUnit_SetJmpRunner_Fixture.o libaceunit-setjmp.a %_Fixture.c: %_Test.o