Zhang Xin yu
/
zhangxinyu1
333333333
Diff: tests.h
- Revision:
- 11:1447cb7dce3c
- Parent:
- 10:167d0aa1c9b3
diff -r 167d0aa1c9b3 -r 1447cb7dce3c tests.h --- a/tests.h Mon Apr 16 18:08:05 2018 +0000 +++ b/tests.h Tue Apr 17 08:00:08 2018 +0000 @@ -3,24 +3,33 @@ #include "Ball-test.h" +/** + * @brief Run all the tests for this program + * + * @returns The number of tests that failed + */ int run_all_tests() { - int n_tests_failed = false; + int n_tests_failed = 0; // A log of the number of tests that have failed // Run the Ball_test_movement test printf("Testing Ball_test_movement...\n"); bool this_test_passed = Ball_test_movement(); - + + // Print out the result of this test if (this_test_passed) { printf("...Passed!\n"); } else { - printf("...FAILED!\n"); - ++n_tests_failed; // Increment number of failures + printf("...FAILED!\n"); + ++n_tests_failed; // Increment number of failures } // Repeat the above for each testing function... + // ... + // ... + // Finish by printing a summary of the tests if (n_tests_failed > 0) { printf("%d tests FAILED!\n", n_tests_failed); }