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-04-24
- Revision:
- 12:1c0b6796aaca
- Child:
- 13:12276eed13ac
File content as of revision 12:1c0b6796aaca:
#ifndef MAP_TEST_H #define MAP_TEST_H /** Map Test @brief Checks Spcaceship goes to the correct postion when moved @author Benjamin Evans, University of Leeds @date April 2020 @return true if test are passed */ bool map_draw_test(){ // Objects reqired for test N5110 lcd; Gamepad pad; Map map; Serial usb(USBTX, USBRX); AnalogIn adc(PTD5); // Flag to return if test passed bool pass_flag = true; // Initialise map in start postion of -84, 42 and draw lcd.init(); map.init(adc); map.draw_map(lcd,0); // Reads start spaceship postion int start_x_postion = map.get_position_x_map(); usb.printf("start postion x = %d\n", start_x_postion); // Test drap map function map.draw_map(lcd,1); // Reads end map position int end_x_postion_one = map.get_position_x_map(); usb.printf("end postion one x = %d\n", end_x_postion_one ); //TO check if map moves in opsite direction map.draw_map(lcd,-1); // Reads end map position int end_x_postion_two = map.get_position_x_map(); usb.printf("end postion two x = %d\n", end_x_postion_two ); // Fail test if start postision is incorrect if (end_x_postion_one != -83 || end_x_postion_two != -84) { pass_flag = false; } return pass_flag; } #endif