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.
Diff: People/People_test.h
- Revision:
- 38:75bd968daa31
- Parent:
- 37:a05eac7fcb4c
- Child:
- 82:3211b31e9421
--- a/People/People_test.h Sat May 16 16:16:43 2020 +0000
+++ b/People/People_test.h Sat May 16 17:19:18 2020 +0000
@@ -42,4 +42,34 @@
return false;
}
}
+
+bool check_alien_collision_test(bool expected_collision, int expected_x){
+
+ // Objects reqired for test
+ Alien alien;
+ People people;
+ Gamepad pad;
+
+ // Initialise people x start position
+ people.init(pad,expected_x);
+
+ printf("collision = %s : " ,expected_collision ? "true" : "false");
+
+ // initialise alien to people posision
+ alien.init(pad,expected_x,43);
+
+ // Checks collision function
+ bool actual_collision = people.check_alien_collision(alien);
+
+ // Checks if collision is espected
+ if (actual_collision == expected_collision) {
+ printf ( "Passed!\n");
+ return true;
+ } else {
+ printf ("Failed! value = %s (expecting %d)\n",
+ actual_collision ? "true" : "false",
+ expected_collision ? "true" : "false");
+ return false;
+ }
+}
#endif
\ No newline at end of file