Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tests.h Source File

tests.h

00001 #ifndef TESTS_H
00002 #define TESTS_H
00003 
00004 
00005 #include "Paddle.h"
00006 #include "Ball.h"
00007 #include "Ball-test.h"
00008 #include "Paddle-Test.h"
00009 /**
00010  * @brief Run all the tests for this program
00011  *
00012  * @returns The number of tests that failed
00013  */
00014 int run_tests()
00015 {
00016     int n_tests_failed = 0; // A log of the number of tests that have failed
00017 
00018     // Run the Ball_test_movement test
00019     printf("Testing Ball_test_movement...\n");
00020     bool Ball_test_passed = Ball_test_movement();
00021 
00022     // Print out the result of this test
00023     if (Ball_test_passed) {
00024         printf("...Passed!\n");
00025     }
00026     else {
00027         printf("...FAILED!\n");
00028         ++n_tests_failed; // Increment number of failures
00029     }
00030     
00031     // Run the Paddle_test_movement test
00032     printf("Testing Paddle_test_movement...\n");
00033     bool Paddle_test_passed = Paddle_test_movement();
00034 
00035     // Print out the result of this test
00036     if (Paddle_test_passed) {
00037         printf("...Passed!\n");
00038     }
00039     else {
00040         printf("...FAILED!\n");
00041         ++n_tests_failed; // Increment number of failures
00042     }
00043     
00044     // Finish by printing a summary of the tests
00045     if (n_tests_failed > 0) {
00046         printf("%d tests FAILED!\n", n_tests_failed);
00047     }
00048     else {
00049         printf("All tests passed!\n");
00050     }
00051 
00052     return n_tests_failed;
00053 }
00054 
00055 #endif