James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
39:dfc489594f11
Child:
40:a1cdb6ab08af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Map/map_test.h	Thu May 09 01:58:36 2019 +0000
@@ -0,0 +1,26 @@
+#ifndef MAP_TEST_H
+#define MAP_TEST_H
+
+/** Map test
+@brief Check that the map generates 1s and 0s correctly without the accelerometer
+@returns true if it generates values as expected, false if not
+*/
+
+bool map_test(){
+    Map map;
+    map.init();
+    bool passed = true;
+    Vector2D coord = {0,0};     //top left coord
+    
+    if (map.get_coordinate(coord) != true) { passed = false; }      //test 1
+    coord = {60,60};        //start area coord
+    if (map.get_coordinate(coord) != 0) { passed = false; }         //test 2
+    coord = {224,590};      //bottom right coord
+    if (map.get_coordinate(coord) != 1) { passed = false; }         //test 3
+    coord = {405,120};      //finish area coord
+    if (map.get_coordinate(coord) != 0) { passed = false; }         //test 4
+    
+    return passed;
+}
+
+#endif
\ No newline at end of file