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/Map_test.h
- Committer:
- evanso
- Date:
- 2020-05-25
- Revision:
- 82:3211b31e9421
- Parent:
- 67:a2984682d641
- Child:
- 85:87bc28b151d8
File content as of revision 82:3211b31e9421:
#ifndef MAP_TEST_H
#define MAP_TEST_H
/** Map Test
* @brief Checks that the map moves to the correct x position depedning on
* joystick input
* @author Benjamin Evans, University of Leeds
* @date April 2020
* @return true if test are passed
*/
bool map_move_test(Direction d_, int expected_x_position) {
// Objects reqired for test
Map map;
N5110 lcd;
Gamepad pad;
// Initialise map in start postion of -84,42
pad.init();
map.init(pad);
printf("Espected map x position = %d, : ",expected_x_position);
// Draws map but with move variable set so it starts above 0
// As can't rea pixel of the LCD
map.draw_map(lcd, d_);
// Reads start postion of map drawn
int map_start_draw_postion = map.get_position_x_map();
// Checks final position with espected
if (map_start_draw_postion == expected_x_position) {
printf ( "Passed!\n");
return true;
} else {
printf ( "Failed! value = %d, (expecting %d)\n",
map_start_draw_postion, expected_x_position);
return false;
}
}
#endif