Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: tests.h
- Revision:
- 39:dfc489594f11
- Child:
- 40:a1cdb6ab08af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests.h Thu May 09 01:58:36 2019 +0000 @@ -0,0 +1,38 @@ +#ifndef TESTS_H +#define TESTS_H + +#include "ball_test.h" +#include "map_test.h" + +/** Tests +@brief Runs all tests for the Labyrinth game +@returns The total number of failures in the testbenches +*/ + +int no_of_tests_failed(){ + //initialise failures to 0 + int quantity_failed = 0; + //run ball test + printf("Testing ball movement:\n"); + bool balltest = ball_test(); + //print results to terminal and increment failure count if failed + if(balltest){ printf("Ball test passed.\n"); } + else if (!(balltest)){ + printf("Ball test failed!\n"); + quantity_failed++; + } + //run map test + printf("Testing map pixel reading:\n"); + bool maptest = map_test(); + //print results to terminal and increment failure count if failed + if(maptest) {printf("Map test passed.\n"); } + else if (!(maptest)){ + printf("Map test failed!\n"); + quantity_failed++; + } + //Summary of results printed to terminal + printf ("Total tests failed = %d\n", quantity_failed); + + return quantity_failed; +} +#endif \ No newline at end of file