Craig Evans
/
Pong2
Pong for Gamepad2
Embed:
(wiki syntax)
Show/hide line numbers
tests.h
00001 #ifndef TESTS_H 00002 #define TESTS_H 00003 00004 #include "Ball-test.h" 00005 00006 /** 00007 * @brief Run all the tests for this program 00008 * 00009 * @returns The number of tests that failed 00010 */ 00011 int run_all_tests() 00012 { 00013 int n_tests_failed = 0; // A log of the number of tests that have failed 00014 00015 // Run the Ball_test_movement test 00016 printf("Testing Ball_test_movement...\n"); 00017 bool this_test_passed = Ball_test_movement(); 00018 00019 // Print out the result of this test 00020 if (this_test_passed) { 00021 printf("...Passed!\n"); 00022 } 00023 else { 00024 printf("...FAILED!\n"); 00025 ++n_tests_failed; // Increment number of failures 00026 } 00027 00028 // Repeat the above for each testing function... 00029 // ... 00030 // ... 00031 00032 // Finish by printing a summary of the tests 00033 if (n_tests_failed > 0) { 00034 printf("%d tests FAILED!\n", n_tests_failed); 00035 } 00036 else { 00037 printf("All tests passed!\n"); 00038 } 00039 00040 return n_tests_failed; 00041 } 00042 00043 #endif
Generated on Sat Jul 16 2022 18:01:16 by 1.7.2