Zeyu Feng 201377605

Dependencies:   mbed

On Minerva

tests.h

Committer:
el19zf
Date:
2020-05-22
Revision:
22:cded0cd8e1c9
Parent:
15:3571beaaeed8

File content as of revision 22:cded0cd8e1c9:

#ifndef TEST_H
#define TEST_H

#include "People-test.h"
#include "shot-test.h"

/**run all the tests of this program

  *returns number of failed tests
*/

int run_all_tests()
{
    int failed_tests = 0;
    
    printf("Testing...\n");
    bool test_passed1 = People_test();
    bool test_passed2 = shot_test();
    
    //print the result of each test
    if(test_passed1){
        printf("...People TEST Passed!\n");
    }else{
        printf("...People TEST Failed\n");
        failed_tests++;
    }
    if(test_passed2){
        printf("...shot TEST Passed!\n");
    }else{
        printf("...shot TEST Failed\n");
        failed_tests++;
    }
    
    //print test result
    if(failed_tests > 0){
        printf("%d tests failed...\n",failed_tests);
    }else{
        printf("All tests PASSED!!\n");
    }
    
    return failed_tests;
}

#endif