ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tests.h Source File

tests.h

00001 #ifndef TEST_H
00002 #define TEST_H
00003 
00004 #include "People-test.h"
00005 #include "shot-test.h"
00006 
00007 /**run all the tests of this program
00008 
00009   *returns number of failed tests
00010 */
00011 
00012 int run_all_tests()
00013 {
00014     int failed_tests = 0;
00015     
00016     printf("Testing...\n");
00017     bool test_passed1 = People_test();
00018     bool test_passed2 = shot_test();
00019     
00020     //print the result of each test
00021     if(test_passed1){
00022         printf("...People TEST Passed!\n");
00023     }else{
00024         printf("...People TEST Failed\n");
00025         failed_tests++;
00026     }
00027     if(test_passed2){
00028         printf("...shot TEST Passed!\n");
00029     }else{
00030         printf("...shot TEST Failed\n");
00031         failed_tests++;
00032     }
00033     
00034     //print test result
00035     if(failed_tests > 0){
00036         printf("%d tests failed...\n",failed_tests);
00037     }else{
00038         printf("All tests PASSED!!\n");
00039     }
00040     
00041     return failed_tests;
00042 }
00043 
00044 #endif