James Cummins / Mbed 2 deprecated el17jnc

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 #include "ball_test.h"
00005 #include "map_test.h"
00006 
00007 /** Tests
00008 @brief Runs all tests for the Labyrinth game
00009 @returns The total number of failures in the testbenches
00010 */ 
00011 
00012 int no_of_tests_failed(){
00013     //initialise failures to 0
00014     int quantity_failed = 0;
00015     
00016     //run ball test
00017     printf("Testing ball movement:\n");
00018     bool balltest = ball_test();
00019         //print results to terminal and increment failure count if failed
00020     if(balltest){ printf("Ball test passed.\n"); }
00021     else if (!(balltest)){
00022         printf("Ball test failed!\n");
00023         quantity_failed++;
00024     }
00025     //run map test
00026     printf("Testing map pixel reading:\n");
00027     bool maptest = map_test();
00028             //print results to terminal and increment failure count if failed
00029     if(maptest) {printf("Map test passed.\n"); }
00030     else if (!(maptest)){
00031         printf("Map test failed!\n");
00032         quantity_failed++;
00033     }
00034     //Summary of results printed to terminal
00035     printf ("Total tests failed = %d\n", quantity_failed);
00036     
00037     return quantity_failed;
00038 }
00039 #endif