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.
Dependencies: mbed
Aim/Aim_test.h@13:cfdfe60a2327, 2020-05-18 (annotated)
- 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?
| User | Revision | Line number | New 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 | 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 | |
| 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 | 13:cfdfe60a2327 | 21 | printf("%f, %f\n", read_pos_1.x, read_pos_1.y); |
| 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 | 13:cfdfe60a2327 | 28 | if (read_pos_1.x != 42 || read_pos_1.y != 5) { |
| 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 |