ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Committer:
el18jgb
Date:
Mon May 18 15:46:04 2020 +0000
Revision:
13:cfdfe60a2327
Child:
21:a0f3651f56c4
good bit of a clean up to create and test new functions withing classes with ease;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18jgb 13:cfdfe60a2327 1 #ifndef SPIKES_TEST_H
el18jgb 13:cfdfe60a2327 2 #define SPIKES_TEST_H
el18jgb 13:cfdfe60a2327 3
el18jgb 13:cfdfe60a2327 4 /** ENG Test
el18jgb 13:cfdfe60a2327 5 * @brief Checks that the calulate_map_movement caluclates correct map_movement
el18jgb 13:cfdfe60a2327 6 * @author Jospeh Body, University of Leeds
el18jgb 13:cfdfe60a2327 7 * @date May 2020
el18jgb 13:cfdfe60a2327 8 * @return true if test are passed
el18jgb 13:cfdfe60a2327 9 */
el18jgb 13:cfdfe60a2327 10
el18jgb 13:cfdfe60a2327 11 bool Spikes_test_initial()
el18jgb 13:cfdfe60a2327 12 {
el18jgb 13:cfdfe60a2327 13 // Initialise
el18jgb 13:cfdfe60a2327 14 Spikes spikes;
el18jgb 13:cfdfe60a2327 15 spikes.init(); //_x = 0 _y = 0
el18jgb 13:cfdfe60a2327 16
el18jgb 13:cfdfe60a2327 17 // Read the position
el18jgb 13:cfdfe60a2327 18 Vector2D read_pos_1 = spikes.get_pos();
el18jgb 13:cfdfe60a2327 19 printf("%f, %f\n", read_pos_1.x, read_pos_1.y);
el18jgb 13:cfdfe60a2327 20
el18jgb 13:cfdfe60a2327 21 // Now check that both the position is as expected
el18jgb 13:cfdfe60a2327 22 bool success_flag = true;
el18jgb 13:cfdfe60a2327 23
el18jgb 13:cfdfe60a2327 24 // Fail the test if the initial position is wrong
el18jgb 13:cfdfe60a2327 25 if (read_pos_1.x != 0 || read_pos_1.y != 0) {
el18jgb 13:cfdfe60a2327 26 success_flag = false;
el18jgb 13:cfdfe60a2327 27 }
el18jgb 13:cfdfe60a2327 28
el18jgb 13:cfdfe60a2327 29 return success_flag;
el18jgb 13:cfdfe60a2327 30 }
el18jgb 13:cfdfe60a2327 31
el18jgb 13:cfdfe60a2327 32 #endif