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: main.cpp
- 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