James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
39:dfc489594f11
Parent:
38:a85bc227b907
Child:
40:a1cdb6ab08af
--- a/main.cpp	Thu May 09 01:09:18 2019 +0000
+++ b/main.cpp	Thu May 09 01:58:36 2019 +0000
@@ -15,6 +15,11 @@
 #include "ClassicEngine.h"
 #include "OptionsEngine.h"
 #include "SDFileSystem.h"
+
+#ifdef WITH_TESTS
+    #include "tests.h"
+#endif
+
 #define RADIUS 3
 
 
@@ -59,6 +64,12 @@
 int fps = 16;   //declared globally so it doesn't have to be passed to
                 //the different game mode functions
 int main(){
+    
+#ifdef WITH_TESTS                                   //run tests to check code is correct
+    int test_failures = no_of_tests_failed();
+    if(test_failures > 0){ return test_failures; }      //main function returns no of failures
+#endif
+    
     init();             //first initialise all objects
     startscreen();      //then display the introductory screen
     while(1){                //keep game running until power is removed