ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Committer:
el18jgb
Date:
Sun May 24 10:28:20 2020 +0000
Revision:
22:7406068f6c59
Parent:
21:a0f3651f56c4
last checks;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18jgb 13:cfdfe60a2327 1 #ifndef AIM_TEST_H
el18jgb 13:cfdfe60a2327 2 #define AIM_TEST_H
el18jgb 13:cfdfe60a2327 3
el18jgb 13:cfdfe60a2327 4 /** Aim class Test
el18jgb 22:7406068f6c59 5 * @brief tests to do with the cursor
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
el18jgb 13:cfdfe60a2327 12
el18jgb 13:cfdfe60a2327 13 bool Aim_test_initial()
el18jgb 13:cfdfe60a2327 14 {
el18jgb 13:cfdfe60a2327 15 // Initialise
el18jgb 13:cfdfe60a2327 16 Aim aim;
el18jgb 13:cfdfe60a2327 17 aim.init(); //_x = 42 _y = 5
el18jgb 13:cfdfe60a2327 18
el18jgb 13:cfdfe60a2327 19 // Read the position
el18jgb 13:cfdfe60a2327 20 Vector2D read_pos_1 = aim.get_pos();
el18jgb 21:a0f3651f56c4 21 printf("%f, %f\n", read_pos_1.x, read_pos_1.y);//aim pos has +2
el18jgb 13:cfdfe60a2327 22
el18jgb 13:cfdfe60a2327 23
el18jgb 13:cfdfe60a2327 24 // Now check that both the position is as expected
el18jgb 13:cfdfe60a2327 25 bool success_flag = true;
el18jgb 13:cfdfe60a2327 26
el18jgb 13:cfdfe60a2327 27 // Fail the test if the initial position is wrong
el18jgb 21:a0f3651f56c4 28 if (read_pos_1.x != 44 || read_pos_1.y != 7) {
el18jgb 13:cfdfe60a2327 29 success_flag = false;
el18jgb 13:cfdfe60a2327 30 }
el18jgb 13:cfdfe60a2327 31
el18jgb 13:cfdfe60a2327 32 return success_flag;
el18jgb 13:cfdfe60a2327 33 }
el18jgb 13:cfdfe60a2327 34
el18jgb 13:cfdfe60a2327 35
el18jgb 13:cfdfe60a2327 36 #endif