Reham Faqehi / Mbed 2 deprecated fy15raf

Dependencies:   mbed

Fork of fy15raf by ELEC2645 (2017/18)

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 #include "Asteroid-test.h"
00005 #include "Spaceship-test.h"
00006 
00007 /**
00008  * @brief Run all the tests for this game
00009  *
00010  * @returns The number of tests that failed
00011  */
00012 int Run_tests()
00013 {
00014     int tests_failed = 0; // number of tests that failed
00015 
00016 ////////////////////Asteroid testing////////////////////////////
00017 
00018    // Run the Asteroid_test_movement test
00019     printf(".....Testing Asteroid_movement.....\n");
00020     bool Asteroid_test_passed = Asteroid_movement();
00021 
00022     // Print out the result of all tests in Asteroid_movement
00023     if (Asteroid_test_passed) {
00024         printf("...PASSED!\n\n");
00025     }
00026     else {
00027         printf("...FAILED!\n\n");
00028         ++tests_failed; // Increase failures
00029     }
00030     
00031 ////////////////////Spaceship testing////////////////////////////
00032 
00033     // Run the Spaceship_test_movement test
00034     printf(".....Testing Spaceship_movement.....\n");
00035     bool Spaceship_test_passed = Spaceship_movement();
00036     
00037     // Print out the result of all tests in Spaceship_movement
00038     if (Spaceship_test_passed) {
00039         printf("...PASSED!\n\n");
00040     }
00041     else {
00042         printf("...FAILED!\n\n");
00043         ++tests_failed; // Increase failures
00044     }
00045  
00046  
00047  
00048     //summary of the tests
00049     if (tests_failed > 0) {
00050         printf("%d tests FAILED!\n", tests_failed);
00051     }
00052     else {
00053         printf("All tests passed!\n");
00054     }
00055 
00056     return tests_failed;
00057 }
00058 
00059 #endif