Wang Lin 201090174

Dependencies:   mbed Gamepad N5110 FXOS8700Q

Committer:
valavanisalex
Date:
Mon Apr 16 18:08:05 2018 +0000
Revision:
10:167d0aa1c9b3
Child:
11:1447cb7dce3c
Added Ball test example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
valavanisalex 10:167d0aa1c9b3 1 #ifndef TESTS_H
valavanisalex 10:167d0aa1c9b3 2 #define TESTS_H
valavanisalex 10:167d0aa1c9b3 3
valavanisalex 10:167d0aa1c9b3 4 #include "Ball-test.h"
valavanisalex 10:167d0aa1c9b3 5
valavanisalex 10:167d0aa1c9b3 6 int run_all_tests()
valavanisalex 10:167d0aa1c9b3 7 {
valavanisalex 10:167d0aa1c9b3 8 int n_tests_failed = false;
valavanisalex 10:167d0aa1c9b3 9
valavanisalex 10:167d0aa1c9b3 10 // Run the Ball_test_movement test
valavanisalex 10:167d0aa1c9b3 11 printf("Testing Ball_test_movement...\n");
valavanisalex 10:167d0aa1c9b3 12 bool this_test_passed = Ball_test_movement();
valavanisalex 10:167d0aa1c9b3 13
valavanisalex 10:167d0aa1c9b3 14 if (this_test_passed) {
valavanisalex 10:167d0aa1c9b3 15 printf("...Passed!\n");
valavanisalex 10:167d0aa1c9b3 16 }
valavanisalex 10:167d0aa1c9b3 17 else {
valavanisalex 10:167d0aa1c9b3 18 printf("...FAILED!\n");
valavanisalex 10:167d0aa1c9b3 19 ++n_tests_failed; // Increment number of failures
valavanisalex 10:167d0aa1c9b3 20 }
valavanisalex 10:167d0aa1c9b3 21
valavanisalex 10:167d0aa1c9b3 22 // Repeat the above for each testing function...
valavanisalex 10:167d0aa1c9b3 23
valavanisalex 10:167d0aa1c9b3 24 if (n_tests_failed > 0) {
valavanisalex 10:167d0aa1c9b3 25 printf("%d tests FAILED!\n", n_tests_failed);
valavanisalex 10:167d0aa1c9b3 26 }
valavanisalex 10:167d0aa1c9b3 27 else {
valavanisalex 10:167d0aa1c9b3 28 printf("All tests passed!\n");
valavanisalex 10:167d0aa1c9b3 29 }
valavanisalex 10:167d0aa1c9b3 30
valavanisalex 10:167d0aa1c9b3 31 return n_tests_failed;
valavanisalex 10:167d0aa1c9b3 32 }
valavanisalex 10:167d0aa1c9b3 33
valavanisalex 10:167d0aa1c9b3 34 #endif