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