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.
map_test.h
00001 #ifndef MAP_TEST_H 00002 #define MAP_TEST_H 00003 00004 /** Map test 00005 @brief Check that the map generates 1s and 0s correctly without the accelerometer 00006 @returns true if it generates values as expected, false if not 00007 */ 00008 00009 bool map_test(){ 00010 Map map; 00011 map.init(); 00012 bool passed = true; 00013 Vector2D coord = {0,0}; //top left coord 00014 printf("Running...\n"); 00015 00016 int pixel = map.get_coordinate(coord); 00017 printf("1st pixel = %d\n", pixel); 00018 if (pixel != 1) { //test 1 - test what should be a black pixel 00019 passed = false; 00020 printf("Coord 1 failed\n"); 00021 } 00022 coord.x = 60; //start area coord 00023 coord.y = 60; 00024 00025 pixel = map.get_coordinate(coord); 00026 printf("2nd pixel = %d\n", pixel); 00027 if (pixel != 0) { //test 2 - test what should be a white pixel 00028 passed = false; 00029 printf("Coord 2 failed\n"); 00030 } 00031 return passed; 00032 } 00033 00034 #endif
Generated on Thu Jul 14 2022 00:39:27 by
1.7.2