Ben Evans University Second Year Project. Game Called Defender.

Dependencies:   mbed

https://os.mbed.com/media/uploads/evanso/84bc1a30759fd6a1e3f1fd1fae3e97c2.png

Hello, soldier, you have been specially selected as the defender of planet earth.

Your mission, if you choose to accept it. Fly around the planet and pulverise invading alien ships for as long as you can. Stop the aliens abducting the innocent people on the ground. Be warned if an alien ship manages to abduct a person and take them to top of the screen, they will no longer move randomly and will begin to hunt you down. This sounds like a challenge you were trained for.

But don’t worry soldier you’re not going into battle empty-handed. Your ship is equipped with a state of the art laser beam that has unlimited ammo and four smart bombs that will destroy anything on the screen. The ship also has three lives so use them wisely.

As time goes on more alien ships will arrive on planet earth increasing the difficulty of your mission. And remember the landscape bellow loops around so if you continually fly in the same direction you go to your original position. Good luck soldier.

Committer:
evanso
Date:
Sun May 24 21:11:55 2020 +0000
Revision:
79:66bcf8fa2d2d
Parent:
70:8c4572d17441
Child:
82:3211b31e9421
Added high score unit test which it passed!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 11:ab578a151f67 1 #ifndef TESTS_H
evanso 11:ab578a151f67 2 #define TESTS_H
evanso 11:ab578a151f67 3
evanso 11:ab578a151f67 4 #include "Spaceship_test.h"
evanso 14:7419c680656f 5 #include "Map_test.h"
evanso 22:053c11a202e1 6 #include "Alien_test.h"
evanso 23:cc44e26c08fa 7 #include "Weapons_test.h"
evanso 26:1a7056eb3253 8 #include "Explosion_test.h"
evanso 37:a05eac7fcb4c 9 #include "People_test.h"
evanso 65:daa792a09e1f 10 #include "Menu_test.h"
evanso 66:33f479036a5d 11 #include "HUD_test.h"
evanso 67:a2984682d641 12 #include "SavedGames_test.h"
evanso 70:8c4572d17441 13 #include "Settings_test.h"
evanso 79:66bcf8fa2d2d 14 #include "HighScore_test.h"
evanso 11:ab578a151f67 15
evanso 11:ab578a151f67 16 /** Test
evanso 27:8bb2bd97c319 17 * @brief Runs all tests for game
evanso 27:8bb2bd97c319 18 * @author Benjamin Evans, University of Leeds
evanso 27:8bb2bd97c319 19 * @date April 2020
evanso 27:8bb2bd97c319 20 */
evanso 13:12276eed13ac 21 // Spaceship tests -------------------------------------------------------------
evanso 65:daa792a09e1f 22
evanso 13:12276eed13ac 23 void run_spaceship_movement_tests(){
evanso 13:12276eed13ac 24 printf ("\nTesting spaceship_movement_test() \n");
evanso 13:12276eed13ac 25 int passed_counter = 0;
evanso 13:12276eed13ac 26
evanso 13:12276eed13ac 27 // Runs test with all posible movment directions
evanso 13:12276eed13ac 28 if (spaceship_movement_test(CENTRE, 36, 22)) passed_counter++;
evanso 13:12276eed13ac 29 if (spaceship_movement_test(N, 36, 21)) passed_counter++;
evanso 16:1ee3d3804557 30 if (spaceship_movement_test(NE, 35, 21)) passed_counter++;
evanso 16:1ee3d3804557 31 if (spaceship_movement_test(E, 35, 22)) passed_counter++;
evanso 16:1ee3d3804557 32 if (spaceship_movement_test(SE, 35, 23)) passed_counter++;
evanso 13:12276eed13ac 33 if (spaceship_movement_test(S, 36, 23)) passed_counter++;
evanso 16:1ee3d3804557 34 if (spaceship_movement_test(SW, 37, 23)) passed_counter++;
evanso 16:1ee3d3804557 35 if (spaceship_movement_test(W, 37, 22)) passed_counter++;
evanso 16:1ee3d3804557 36 if (spaceship_movement_test(NW, 37, 21)) passed_counter++;
evanso 11:ab578a151f67 37
evanso 13:12276eed13ac 38 // prints results
evanso 37:a05eac7fcb4c 39 printf ("\nspaceship_movement_test passed %d tests out of 9\n\n\n",
evanso 27:8bb2bd97c319 40 passed_counter);
evanso 12:1c0b6796aaca 41 }
evanso 12:1c0b6796aaca 42
evanso 13:12276eed13ac 43 void run_spaceship_draw_tests(){
evanso 37:a05eac7fcb4c 44 printf ("\nTesting spaceship_draw_tests() \n\n");
evanso 13:12276eed13ac 45 int passed_counter = 0;
evanso 12:1c0b6796aaca 46
evanso 13:12276eed13ac 47 // Runs test with max movement directions
evanso 65:daa792a09e1f 48 if (spaceship_draw_test(NE, 1, 15, 9)) passed_counter++;
evanso 16:1ee3d3804557 49 if (spaceship_draw_test(SE, 1, 15, 44)) passed_counter++;
evanso 16:1ee3d3804557 50 if (spaceship_draw_test(SW, 1, 64, 44)) passed_counter++;
evanso 65:daa792a09e1f 51 if (spaceship_draw_test(NW, 1, 64, 9)) passed_counter++;
evanso 13:12276eed13ac 52
evanso 13:12276eed13ac 53 // prints results
evanso 37:a05eac7fcb4c 54 printf ("\nspaceship_draw_test passed %d tests out of 4\n\n\n",passed_counter);
evanso 11:ab578a151f67 55 }
evanso 11:ab578a151f67 56
evanso 65:daa792a09e1f 57
evanso 65:daa792a09e1f 58
evanso 13:12276eed13ac 59 // Map tests -------------------------------------------------------------------
evanso 13:12276eed13ac 60
evanso 14:7419c680656f 61 void run_map_draw_tests(){
evanso 37:a05eac7fcb4c 62 printf ("\nTesting map_draw_tests() \n\n");
evanso 14:7419c680656f 63 int passed_counter = 0;
evanso 14:7419c680656f 64
evanso 14:7419c680656f 65 // Runs multiple map tests
evanso 18:11068b98e261 66 if (map_move_test(CENTRE, -84)) passed_counter++;
evanso 18:11068b98e261 67 if (map_move_test(N, -84)) passed_counter++;
evanso 18:11068b98e261 68 if (map_move_test(NE,-86)) passed_counter++;
evanso 18:11068b98e261 69 if (map_move_test(E, -86)) passed_counter++;
evanso 18:11068b98e261 70 if (map_move_test(SE, -86)) passed_counter++;
evanso 18:11068b98e261 71 if (map_move_test(S, -84)) passed_counter++;
evanso 18:11068b98e261 72 if (map_move_test(SW, -82)) passed_counter++;
evanso 18:11068b98e261 73 if (map_move_test(W, -82)) passed_counter++;
evanso 18:11068b98e261 74 if (map_move_test(NW, -82)) passed_counter++;
evanso 14:7419c680656f 75
evanso 14:7419c680656f 76 // prints results
evanso 37:a05eac7fcb4c 77 printf ("\nmap_draw_test passed %d tests out of 9\n\n\n",passed_counter);
evanso 14:7419c680656f 78 }
evanso 13:12276eed13ac 79
evanso 65:daa792a09e1f 80
evanso 65:daa792a09e1f 81
evanso 22:053c11a202e1 82 // Alien tests -----------------------------------------------------------------
evanso 65:daa792a09e1f 83
evanso 37:a05eac7fcb4c 84 void run_alien_draw_tests(){
evanso 37:a05eac7fcb4c 85 printf ("\nTesting alien_draw_test() \n\n");
evanso 22:053c11a202e1 86 int passed_counter = 0;
evanso 22:053c11a202e1 87
evanso 22:053c11a202e1 88 // Runs test with all posible movment directions
evanso 37:a05eac7fcb4c 89 if (alien_draw_test(1,CENTRE, 1, 1)) passed_counter++;
evanso 37:a05eac7fcb4c 90 if (alien_draw_test(1,N, 43, 20)) passed_counter++;
evanso 37:a05eac7fcb4c 91 if (alien_draw_test(0,NE, -23, 6)) passed_counter++;
evanso 37:a05eac7fcb4c 92 if (alien_draw_test(0,E, 23, -34)) passed_counter++;
evanso 37:a05eac7fcb4c 93 if (alien_draw_test(0,SE, -23, -43)) passed_counter++;
evanso 37:a05eac7fcb4c 94 if (alien_draw_test(0,S, 100, 26)) passed_counter++;
evanso 37:a05eac7fcb4c 95 if (alien_draw_test(0,SE, 40, 100)) passed_counter++;
evanso 37:a05eac7fcb4c 96 if (alien_draw_test(1,E, 70, 5)) passed_counter++;
evanso 37:a05eac7fcb4c 97 if (alien_draw_test(1,NE, 6, 44)) passed_counter++;
evanso 22:053c11a202e1 98
evanso 22:053c11a202e1 99 // prints results
evanso 37:a05eac7fcb4c 100 printf ("\nalien_draw_test passed %d tests out of 9\n\n\n",passed_counter);
evanso 22:053c11a202e1 101 }
evanso 22:053c11a202e1 102
evanso 38:75bd968daa31 103 void run_check_collision_test(){
evanso 37:a05eac7fcb4c 104 printf ("\nTesting alien_collision_test() \n\n");
evanso 22:053c11a202e1 105 int passed_counter = 0;
evanso 22:053c11a202e1 106
evanso 22:053c11a202e1 107 // Runs test with all differnt possible inputs
evanso 38:75bd968daa31 108 if (check_collision_test(1, 1, 10,22)) passed_counter++;
evanso 38:75bd968daa31 109 if (check_collision_test(0, 1, 28,40)) passed_counter++;
evanso 38:75bd968daa31 110 if (check_collision_test(1, 0, 11,22)) passed_counter++;
evanso 38:75bd968daa31 111 if (check_collision_test(0, 0, 20,22)) passed_counter++;
evanso 22:053c11a202e1 112
evanso 22:053c11a202e1 113 // prints results
evanso 37:a05eac7fcb4c 114 printf ("\nalien_draw_test passed %d tests out of 4\n\n\n",passed_counter);
evanso 22:053c11a202e1 115 }
evanso 15:90b6821bcf64 116
evanso 65:daa792a09e1f 117
evanso 27:8bb2bd97c319 118 // Weapons tests ---------------------------------------------------------------
evanso 65:daa792a09e1f 119
evanso 23:cc44e26c08fa 120 void run_weapons_draw_tests(){
evanso 37:a05eac7fcb4c 121 printf ("\nTesting spaceship_draw_tests() \n\n");
evanso 23:cc44e26c08fa 122 int passed_counter = 0;
evanso 23:cc44e26c08fa 123
evanso 23:cc44e26c08fa 124 // Runs test with max movement directions
evanso 23:cc44e26c08fa 125 if (weapons_draw_test(1, 1, 1, 49, 24)) passed_counter++;
evanso 23:cc44e26c08fa 126 if (weapons_draw_test(1, 1, 2, 52, 24)) passed_counter++;
evanso 23:cc44e26c08fa 127 if (weapons_draw_test(0, 1, 2, 49, 24)) passed_counter++;
evanso 23:cc44e26c08fa 128 if (weapons_draw_test(1, 0, 1, 36, 24)) passed_counter++;
evanso 23:cc44e26c08fa 129 if (weapons_draw_test(1, 0, 2, 33, 24)) passed_counter++;
evanso 23:cc44e26c08fa 130 if (weapons_draw_test(0, 0, 2, 33, 24)) passed_counter++;
evanso 23:cc44e26c08fa 131
evanso 23:cc44e26c08fa 132 // prints results
evanso 37:a05eac7fcb4c 133 printf ("\nspaceship_draw_test passed %d tests out of 6\n\n\n",passed_counter);
evanso 23:cc44e26c08fa 134 }
evanso 26:1a7056eb3253 135
evanso 65:daa792a09e1f 136
evanso 65:daa792a09e1f 137
evanso 27:8bb2bd97c319 138 // Explosion tests -------------------------------------------------------------
evanso 65:daa792a09e1f 139
evanso 26:1a7056eb3253 140 void run_explosion_draw_tests(){
evanso 37:a05eac7fcb4c 141 printf ("\nTesting explosion_draw_tests() \n\n");
evanso 26:1a7056eb3253 142 int passed_counter = 0;
evanso 26:1a7056eb3253 143
evanso 26:1a7056eb3253 144 // Runs test with max movement directions
evanso 26:1a7056eb3253 145 if (explosion_draw_test(1, 15, 3)) passed_counter++;
evanso 26:1a7056eb3253 146 if (explosion_draw_test(1, 15, 44)) passed_counter++;
evanso 26:1a7056eb3253 147 if (explosion_draw_test(1, 64, 44)) passed_counter++;
evanso 26:1a7056eb3253 148 if (explosion_draw_test(1, 64, 2)) passed_counter++;
evanso 26:1a7056eb3253 149
evanso 26:1a7056eb3253 150 // prints results
evanso 37:a05eac7fcb4c 151 printf ("\nspaceship_draw_test passed %d tests out of 4\n\n\n",passed_counter);
evanso 37:a05eac7fcb4c 152 }
evanso 37:a05eac7fcb4c 153
evanso 65:daa792a09e1f 154
evanso 65:daa792a09e1f 155
evanso 37:a05eac7fcb4c 156 // People tests ----------------------------------------------------------------
evanso 37:a05eac7fcb4c 157
evanso 37:a05eac7fcb4c 158 void run_people_draw_tests(){
evanso 37:a05eac7fcb4c 159 printf ("\nTesting people_draw_tests() \n\n");
evanso 37:a05eac7fcb4c 160 int passed_counter = 0;
evanso 37:a05eac7fcb4c 161
evanso 37:a05eac7fcb4c 162 // Runs test with max movement directions
evanso 37:a05eac7fcb4c 163 if (people_draw_test(CENTRE, 1,44)) passed_counter++;
evanso 37:a05eac7fcb4c 164 if (people_draw_test(N, 0,100)) passed_counter++;
evanso 37:a05eac7fcb4c 165 if (people_draw_test(NE, 0, -100)) passed_counter++;
evanso 37:a05eac7fcb4c 166 if (people_draw_test(E, 1,0)) passed_counter++;
evanso 37:a05eac7fcb4c 167 if (people_draw_test(SE, 1,82)) passed_counter++;
evanso 37:a05eac7fcb4c 168 if (people_draw_test(S, 1,43)) passed_counter++;
evanso 37:a05eac7fcb4c 169 if (people_draw_test(SW, 0,-64)) passed_counter++;
evanso 37:a05eac7fcb4c 170 if (people_draw_test(W, 0,-6)) passed_counter++;
evanso 37:a05eac7fcb4c 171 if (people_draw_test(NW, 0,84)) passed_counter++;
evanso 37:a05eac7fcb4c 172
evanso 37:a05eac7fcb4c 173 // prints results
evanso 37:a05eac7fcb4c 174 printf ("\npeople_draw_test passed %d tests out of 9\n\n\n",passed_counter);
evanso 26:1a7056eb3253 175 }
evanso 27:8bb2bd97c319 176
evanso 38:75bd968daa31 177 void run_check_alien_collision_test(){
evanso 38:75bd968daa31 178 printf ("\nTesting check_alien_collision_test() \n\n");
evanso 38:75bd968daa31 179 int passed_counter = 0;
evanso 38:75bd968daa31 180
evanso 38:75bd968daa31 181 // Runs test with all differnt possible inputs
evanso 38:75bd968daa31 182 if (check_alien_collision_test(1,1)) passed_counter++;
evanso 38:75bd968daa31 183 if (check_alien_collision_test(1,80)) passed_counter++;
evanso 38:75bd968daa31 184 if (check_alien_collision_test(1,-42)) passed_counter++;
evanso 38:75bd968daa31 185 if (check_alien_collision_test(1,100)) passed_counter++;
evanso 38:75bd968daa31 186
evanso 38:75bd968daa31 187 // prints results
evanso 65:daa792a09e1f 188 printf ("\ncheck_alien_collision_test passed %d tests out of 4\n\n\n",
evanso 65:daa792a09e1f 189 passed_counter);
evanso 65:daa792a09e1f 190 }
evanso 65:daa792a09e1f 191
evanso 65:daa792a09e1f 192
evanso 65:daa792a09e1f 193
evanso 65:daa792a09e1f 194 // Menu tests ------------------------------------------------------------------
evanso 65:daa792a09e1f 195
evanso 65:daa792a09e1f 196 void run_menu_select_part_test(){
evanso 65:daa792a09e1f 197 printf ("\nTesting menu_select_part_test() \n\n");
evanso 65:daa792a09e1f 198 int passed_counter = 0;
evanso 65:daa792a09e1f 199
evanso 65:daa792a09e1f 200 // Runs test with all differnt possible inputs
evanso 65:daa792a09e1f 201 if (menu_select_part_test(play,1)) passed_counter++;
evanso 65:daa792a09e1f 202 if (menu_select_part_test(main_menu,0)) passed_counter++;
evanso 65:daa792a09e1f 203
evanso 65:daa792a09e1f 204 // prints results
evanso 65:daa792a09e1f 205 printf ("\nmenu_select_part_test passed %d tests out of 2\n\n\n",
evanso 65:daa792a09e1f 206 passed_counter);
evanso 65:daa792a09e1f 207 }
evanso 65:daa792a09e1f 208
evanso 65:daa792a09e1f 209 void run_menu_scroll_test(){
evanso 65:daa792a09e1f 210 printf ("\nTesting menu_scroll_test() \n\n");
evanso 65:daa792a09e1f 211 int passed_counter = 0;
evanso 65:daa792a09e1f 212
evanso 65:daa792a09e1f 213 // Runs test with all differnt possible inputs
evanso 65:daa792a09e1f 214 if (menu_scroll_test(CENTRE, play)) passed_counter++;
evanso 65:daa792a09e1f 215 if (menu_scroll_test(N, settings)) passed_counter++;
evanso 65:daa792a09e1f 216 if (menu_scroll_test(NE, settings)) passed_counter++;
evanso 65:daa792a09e1f 217 if (menu_scroll_test(E, play)) passed_counter++;
evanso 79:66bcf8fa2d2d 218 if (menu_scroll_test(SE, high_score)) passed_counter++;
evanso 79:66bcf8fa2d2d 219 if (menu_scroll_test(S, high_score)) passed_counter++;
evanso 79:66bcf8fa2d2d 220 if (menu_scroll_test(SW, high_score)) passed_counter++;
evanso 65:daa792a09e1f 221 if (menu_scroll_test(W, play)) passed_counter++;
evanso 65:daa792a09e1f 222 if (menu_scroll_test(NW, settings)) passed_counter++;
evanso 65:daa792a09e1f 223
evanso 65:daa792a09e1f 224 // prints results
evanso 65:daa792a09e1f 225 printf ("\nmenu_scroll_test passed %d tests out of 9\n\n\n",
evanso 65:daa792a09e1f 226 passed_counter);
evanso 38:75bd968daa31 227 }
evanso 38:75bd968daa31 228
evanso 70:8c4572d17441 229 void run_menu_draw_part_test(){
evanso 70:8c4572d17441 230 printf ("\nmenu_draw_part_test() \n\n");
evanso 70:8c4572d17441 231 int passed_counter = 0;
evanso 70:8c4572d17441 232
evanso 70:8c4572d17441 233 // Runs test with all differnt possible inputs
evanso 70:8c4572d17441 234 if (menu_draw_part_test(1, 42, 27)) passed_counter++;
evanso 70:8c4572d17441 235 if (menu_draw_part_test(1, 41, 43)) passed_counter++;
evanso 70:8c4572d17441 236 if (menu_draw_part_test(0, 9, 1)) passed_counter++;
evanso 70:8c4572d17441 237 if (menu_draw_part_test(0, 0, 0)) passed_counter++;
evanso 70:8c4572d17441 238
evanso 70:8c4572d17441 239 // prints results
evanso 70:8c4572d17441 240 printf ("\nmenu_draw_part_test %d tests out of 4\n\n\n",
evanso 70:8c4572d17441 241 passed_counter);
evanso 70:8c4572d17441 242 }
evanso 70:8c4572d17441 243
evanso 70:8c4572d17441 244
evanso 66:33f479036a5d 245
evanso 66:33f479036a5d 246
evanso 66:33f479036a5d 247 // HUD tests -------------------------------------------------------------------
evanso 66:33f479036a5d 248
evanso 66:33f479036a5d 249 void run_HUD_draw_test(){
evanso 66:33f479036a5d 250 printf ("\nTesting HUD_draw_test() \n\n");
evanso 66:33f479036a5d 251 int passed_counter = 0;
evanso 66:33f479036a5d 252
evanso 66:33f479036a5d 253 // Runs test with all differnt possible inputs
evanso 66:33f479036a5d 254 if (HUD_draw_test(3, 0, 4, 1, 3, 3)) passed_counter++;
evanso 66:33f479036a5d 255 if (HUD_draw_test(3, 0, 4, 1, 12, 3)) passed_counter++;
evanso 66:33f479036a5d 256 if (HUD_draw_test(1, 0, 4, 0, 12, 3)) passed_counter++;
evanso 66:33f479036a5d 257 if (HUD_draw_test(3, 0, 4, 1, 62, 3)) passed_counter++;
evanso 66:33f479036a5d 258 if (HUD_draw_test(3, 0, 3, 0, 62, 3)) passed_counter++;
evanso 66:33f479036a5d 259 if (HUD_draw_test(3, 0, 3, 1, 30, 3)) passed_counter++;
evanso 66:33f479036a5d 260 if (HUD_draw_test(3, 1111, 3, 00, 30, 3)) passed_counter++;
evanso 66:33f479036a5d 261
evanso 66:33f479036a5d 262 // prints results
evanso 66:33f479036a5d 263 printf ("\nHUD_draw_test passed %d tests out of 7\n\n\n",
evanso 66:33f479036a5d 264 passed_counter);
evanso 66:33f479036a5d 265 }
evanso 66:33f479036a5d 266
evanso 70:8c4572d17441 267
evanso 70:8c4572d17441 268
evanso 70:8c4572d17441 269
evanso 67:a2984682d641 270 // Saved Games tests -----------------------------------------------------------
evanso 67:a2984682d641 271
evanso 67:a2984682d641 272 void run_saved_games_scroll_test(){
evanso 67:a2984682d641 273 printf ("\nsaved_games_scroll_test() \n\n");
evanso 67:a2984682d641 274 int passed_counter = 0;
evanso 67:a2984682d641 275
evanso 67:a2984682d641 276 // Runs test with all differnt possible inputs
evanso 67:a2984682d641 277 if (saved_games_scroll_test(CENTRE, 1)) passed_counter++;
evanso 67:a2984682d641 278 if (saved_games_scroll_test(N, 2)) passed_counter++;
evanso 67:a2984682d641 279 if (saved_games_scroll_test(NE, 2)) passed_counter++;
evanso 67:a2984682d641 280 if (saved_games_scroll_test(E, 1)) passed_counter++;
evanso 67:a2984682d641 281 if (saved_games_scroll_test(SE, 3)) passed_counter++;
evanso 67:a2984682d641 282 if (saved_games_scroll_test(S, 3)) passed_counter++;
evanso 67:a2984682d641 283 if (saved_games_scroll_test(SW, 3)) passed_counter++;
evanso 67:a2984682d641 284 if (saved_games_scroll_test(W, 1)) passed_counter++;
evanso 67:a2984682d641 285 if (saved_games_scroll_test(NW, 2)) passed_counter++;
evanso 67:a2984682d641 286
evanso 67:a2984682d641 287 // prints results
evanso 67:a2984682d641 288 printf ("\nsaved_games_scroll_test passed %d tests out of 9\n\n\n",
evanso 67:a2984682d641 289 passed_counter);
evanso 67:a2984682d641 290 }
evanso 67:a2984682d641 291
evanso 67:a2984682d641 292 void run_display_saved_games_test(){
evanso 67:a2984682d641 293 printf ("\nTesting display_saved_games_test() \n\n");
evanso 67:a2984682d641 294 int passed_counter = 0;
evanso 67:a2984682d641 295
evanso 67:a2984682d641 296 // Runs test with all differnt possible inputs
evanso 67:a2984682d641 297 if (display_saved_games_test(1, 41, 18 )) passed_counter++;
evanso 67:a2984682d641 298 if (display_saved_games_test(1, 41, 34)) passed_counter++;
evanso 67:a2984682d641 299 if (display_saved_games_test(1, 9, 1)) passed_counter++;
evanso 67:a2984682d641 300 if (display_saved_games_test(0, 0, 0)) passed_counter++;
evanso 67:a2984682d641 301
evanso 67:a2984682d641 302 // prints results
evanso 67:a2984682d641 303 printf ("\ndisplay_saved_games_test %d tests out of 4\n\n\n",
evanso 67:a2984682d641 304 passed_counter);
evanso 67:a2984682d641 305 }
evanso 67:a2984682d641 306
evanso 67:a2984682d641 307 void run_save_game_screen_test(){
evanso 67:a2984682d641 308 printf ("\nTesting save_game_screen_test() \n\n");
evanso 67:a2984682d641 309 int passed_counter = 0;
evanso 67:a2984682d641 310
evanso 67:a2984682d641 311 // Runs test with all differnt possible inputs
evanso 67:a2984682d641 312 if (save_game_screen_test(1, 41, 18 )) passed_counter++;
evanso 67:a2984682d641 313 if (save_game_screen_test(1, 41, 34)) passed_counter++;
evanso 67:a2984682d641 314 if (save_game_screen_test(1, 3, 1)) passed_counter++;
evanso 67:a2984682d641 315 if (save_game_screen_test(0, 0, 0)) passed_counter++;
evanso 67:a2984682d641 316
evanso 67:a2984682d641 317 // prints results
evanso 70:8c4572d17441 318 printf ("\nsave_game_screen_test %d tests out of 4\n\n\n",
evanso 67:a2984682d641 319 passed_counter);
evanso 67:a2984682d641 320 }
evanso 67:a2984682d641 321
evanso 67:a2984682d641 322
evanso 70:8c4572d17441 323
evanso 70:8c4572d17441 324 // Settings tests --------------------------------------------------------------
evanso 70:8c4572d17441 325
evanso 70:8c4572d17441 326 void run_settings_select_part_test(){
evanso 70:8c4572d17441 327 printf ("\nTesting settings_select_part_test() \n\n");
evanso 70:8c4572d17441 328 int passed_counter = 0;
evanso 70:8c4572d17441 329
evanso 70:8c4572d17441 330 // Runs test with all differnt possible inputs
evanso 70:8c4572d17441 331 if (settings_select_part_test(acc,1)) passed_counter++;
evanso 70:8c4572d17441 332 if (settings_select_part_test(joy,0)) passed_counter++;
evanso 70:8c4572d17441 333
evanso 70:8c4572d17441 334 // prints results
evanso 70:8c4572d17441 335 printf ("\nsettings_select_part_test passed %d tests out of 2\n\n\n",
evanso 70:8c4572d17441 336 passed_counter);
evanso 70:8c4572d17441 337 }
evanso 70:8c4572d17441 338
evanso 70:8c4572d17441 339 void run_settings_scroll_test(){
evanso 70:8c4572d17441 340 printf ("\nsettings_scroll_test() \n\n");
evanso 70:8c4572d17441 341 int passed_counter = 0;
evanso 70:8c4572d17441 342
evanso 70:8c4572d17441 343 // Runs test with all differnt possible inputs
evanso 70:8c4572d17441 344 if (settings_scroll_test(CENTRE, controls)) passed_counter++;
evanso 70:8c4572d17441 345 if (settings_scroll_test(N, sound_fx)) passed_counter++;
evanso 70:8c4572d17441 346 if (settings_scroll_test(NE, sound_fx)) passed_counter++;
evanso 70:8c4572d17441 347 if (settings_scroll_test(E, controls)) passed_counter++;
evanso 70:8c4572d17441 348 if (settings_scroll_test(SE, contrast)) passed_counter++;
evanso 70:8c4572d17441 349 if (settings_scroll_test(S, contrast)) passed_counter++;
evanso 70:8c4572d17441 350 if (settings_scroll_test(SW, contrast)) passed_counter++;
evanso 70:8c4572d17441 351 if (settings_scroll_test(W, controls)) passed_counter++;
evanso 70:8c4572d17441 352 if (settings_scroll_test(NW, sound_fx)) passed_counter++;
evanso 70:8c4572d17441 353
evanso 70:8c4572d17441 354 // prints results
evanso 70:8c4572d17441 355 printf ("\nsettings_scroll_test passed %d tests out of 9\n\n\n",
evanso 70:8c4572d17441 356 passed_counter);
evanso 70:8c4572d17441 357 }
evanso 70:8c4572d17441 358
evanso 70:8c4572d17441 359 void run_display_settings_screen_test(){
evanso 79:66bcf8fa2d2d 360 printf ("\ndisplay_settings_screen_test() \n\n");
evanso 70:8c4572d17441 361 int passed_counter = 0;
evanso 70:8c4572d17441 362
evanso 70:8c4572d17441 363 // Runs test with all differnt possible inputs
evanso 70:8c4572d17441 364 if (display_settings_screen_test(1, 41, 18 )) passed_counter++;
evanso 70:8c4572d17441 365 if (display_settings_screen_test(1, 41, 34)) passed_counter++;
evanso 70:8c4572d17441 366 if (display_settings_screen_test(0, 9, 1)) passed_counter++;
evanso 70:8c4572d17441 367 if (display_settings_screen_test(0, 0, 0)) passed_counter++;
evanso 70:8c4572d17441 368
evanso 70:8c4572d17441 369 // prints results
evanso 70:8c4572d17441 370 printf ("\ndisplay_settings_screen_test %d tests out of 4\n\n\n",
evanso 70:8c4572d17441 371 passed_counter);
evanso 70:8c4572d17441 372 }
evanso 70:8c4572d17441 373
evanso 79:66bcf8fa2d2d 374
evanso 79:66bcf8fa2d2d 375
evanso 79:66bcf8fa2d2d 376
evanso 79:66bcf8fa2d2d 377 // High Score tests ------------------------------------------------------------
evanso 79:66bcf8fa2d2d 378
evanso 79:66bcf8fa2d2d 379 void run_no_high_scores_test(){
evanso 79:66bcf8fa2d2d 380 printf ("\nno_high_scores_test_test() \n\n");
evanso 79:66bcf8fa2d2d 381 int passed_counter = 0;
evanso 79:66bcf8fa2d2d 382
evanso 79:66bcf8fa2d2d 383 // Runs test with all differnt possible inputs
evanso 79:66bcf8fa2d2d 384 if (no_high_scores_test(1, 0, 27)) passed_counter++;
evanso 79:66bcf8fa2d2d 385 if (no_high_scores_test(1, 3, 35)) passed_counter++;
evanso 79:66bcf8fa2d2d 386 if (no_high_scores_test(0, 9, 1)) passed_counter++;
evanso 79:66bcf8fa2d2d 387 if (no_high_scores_test(0, 0, 0)) passed_counter++;
evanso 79:66bcf8fa2d2d 388
evanso 79:66bcf8fa2d2d 389 // prints results
evanso 79:66bcf8fa2d2d 390 printf ("\nno_high_scores_test %d tests out of 4\n\n\n",
evanso 79:66bcf8fa2d2d 391 passed_counter);
evanso 79:66bcf8fa2d2d 392 }
evanso 79:66bcf8fa2d2d 393
evanso 79:66bcf8fa2d2d 394
evanso 11:ab578a151f67 395 #endif