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 FXOS8700CQQQ
tests.h
00001 #ifndef TESTS_H 00002 #define TESTS_H 00003 #include "RocketRacer.h" 00004 #include "Menus.h" 00005 #include "GameTones.h" 00006 00007 00008 /** tests class 00009 00010 @brief C++ class containing the tests for methods 00011 00012 @version 1.0 00013 00014 @author Omar Alebiary 00015 00016 @date April 2019 00017 00018 @code 00019 00020 #include "mbed.h" 00021 #include "N5110.h" 00022 #include "Gamepad.h" 00023 #include "RocketRacer.h" 00024 00025 // objects 00026 Gamepad pad; 00027 RocketRacer rc; 00028 Menus menus; 00029 tests test; 00030 00031 00032 00033 int main(){ 00034 00035 00036 setup(); 00037 while(1){ 00038 // test.test_welcomeMenu(pad,lcd); 00039 // test.test_Play_Welcome_Melody(pad); 00040 // test.test_End_Game_Melody(Gamepad &pad); 00041 // test.test_drawMenu(lcd, pad); 00042 // test.test_credits_page(lcd,pad); 00043 // test.test_loading_menu(lcd); 00044 // test.test_InstructionsMenu(pad,lcd); 00045 // test.test_Game_Loop(pad,lcd); 00046 // test.test_Joystick_position(pad); 00047 // test.test_Generate_New_Enemy(); 00048 // test.test_Joystick_position(pad); 00049 // test_check_button_pressed(pad,lcd); 00050 test.test_accelerometer_position(pad); 00051 } 00052 00053 00054 00055 00056 } 00057 00058 @endcode 00059 */ 00060 00061 00062 class tests{ 00063 00064 public: 00065 /** 00066 * @brief Default Constructor 00067 * @details Creates the object of class tests 00068 */ 00069 tests(); 00070 /** 00071 * @brief Default destructor 00072 * @details destroys the object of class tests 00073 */ 00074 ~tests(); 00075 /** 00076 * @brief method to test welcome menu 00077 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00078 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00079 */ 00080 void test_welcomeMenu(Gamepad &pad,N5110 &lcd); 00081 /** 00082 * @brief method to test tones played in the game 00083 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00084 */ 00085 void test_Play_Welcome_Melody(Gamepad &pad); 00086 /** 00087 * @brief method to test tones played in the game over screen 00088 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00089 */ 00090 void test_End_Game_Melody(Gamepad &pad); 00091 /** 00092 * @brief method to test the draw main menu method 00093 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00094 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00095 */ 00096 void test_drawMenu(N5110 &lcd,Gamepad &pad); 00097 /** 00098 * @brief method to test the credits page on the menu 00099 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00100 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00101 */ 00102 void test_credits_page(N5110 &lcd,Gamepad &pad); 00103 /** 00104 * @brief method to test the loading page 00105 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00106 */ 00107 void test_loading_menu(N5110 &lcd); 00108 /** 00109 * @brief method to test the instructions page 00110 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00111 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00112 */ 00113 void test_InstructionsMenu(Gamepad &pad,N5110 &lcd); 00114 /** 00115 * @brief method to test the game loop which has all the game methods calls in it 00116 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00117 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00118 */ 00119 void test_Game_Loop(Gamepad &pad,N5110 &lcd); 00120 /** 00121 * @brief method to test the position of the joystick and prints its current state and return true 00122 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00123 */ 00124 bool test_Joystick_position(Gamepad &pad); 00125 /** 00126 * @brief method to test generated numbers 00127 * @details it tests if the randomly genrated number is 1,2 or 3 00128 * @returns true if the condition is met, false otherwise 00129 */ 00130 bool test_Generate_New_Enemy(); 00131 /** 00132 * @brief method to test the position of the accelerometer and prints its current state and return true 00133 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00134 * @returns true if the condition is met, false otherwise 00135 */ 00136 bool test_accelerometer_position(Gamepad &pad); 00137 /** 00138 * @brief method to test button presses in the menu and return true, false otherwise 00139 * @param pad @details calls the Gamepad object to be passed to the methods called inside this method 00140 * @param lcd @details calls the lcd object to be passed to the methods called inside this method 00141 * @returns true if the condition is met, false otherwise 00142 */ 00143 bool test_check_button_pressed(Gamepad &pad,N5110 &lcd); 00144 00145 private: 00146 Menus menu; 00147 RocketRacer Rocket_Racing; 00148 GameTones Game_Tones; 00149 00150 }; 00151 00152 #endif
Generated on Mon Jul 18 2022 07:45:10 by
1.7.2