![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: tests.h
- Revision:
- 68:b9cfd27987ac
- Child:
- 69:55e309da7efd
diff -r 39b9ba6019b0 -r b9cfd27987ac tests.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests.h Sat May 04 16:56:04 2019 +0000 @@ -0,0 +1,43 @@ +#ifndef TESTS_H +#define TESTS_H + +#include "Snake-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 = 0; // A log of the number of tests that have failed + + // Run the Snake_test_movement test + printf("Testing Snake_test_movement...\n"); + bool this_test_passed = Snake_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 + } + + // 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); + } + else { + printf("All tests passed!\n"); + } + + return n_tests_failed; +} + +#endif \ No newline at end of file