Omar Alebiary / Mbed 2 deprecated el17oa

Dependencies:   mbed FXOS8700CQQQ

Embed: (wiki syntax)

« Back to documentation index

tests Class Reference

tests Class Reference

tests class More...

#include <tests.h>

Public Member Functions

 tests ()
 Default Constructor.
 ~tests ()
 Default destructor.
void test_welcomeMenu (Gamepad &pad, N5110 &lcd)
 method to test welcome menu
void test_Play_Welcome_Melody (Gamepad &pad)
 method to test tones played in the game
void test_End_Game_Melody (Gamepad &pad)
 method to test tones played in the game over screen
void test_drawMenu (N5110 &lcd, Gamepad &pad)
 method to test the draw main menu method
void test_credits_page (N5110 &lcd, Gamepad &pad)
 method to test the credits page on the menu
void test_loading_menu (N5110 &lcd)
 method to test the loading page
void test_InstructionsMenu (Gamepad &pad, N5110 &lcd)
 method to test the instructions page
void test_Game_Loop (Gamepad &pad, N5110 &lcd)
 method to test the game loop which has all the game methods calls in it
bool test_Joystick_position (Gamepad &pad)
 method to test the position of the joystick and prints its current state and return true
bool test_Generate_New_Enemy ()
 method to test generated numbers
bool test_accelerometer_position (Gamepad &pad)
 method to test the position of the accelerometer and prints its current state and return true
bool test_check_button_pressed (Gamepad &pad, N5110 &lcd)
 method to test button presses in the menu and return true, false otherwise

Detailed Description

tests class

C++ class containing the tests for methods

Version:
1.0
Author:
Omar Alebiary
Date:
April 2019
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "RocketRacer.h"

// objects 
Gamepad pad;
RocketRacer rc;
Menus menus;
tests test;



int main(){
    
    
     setup();
     while(1){
//     test.test_welcomeMenu(pad,lcd);
//     test.test_Play_Welcome_Melody(pad);
//     test.test_End_Game_Melody(Gamepad &pad);
//     test.test_drawMenu(lcd, pad);
//     test.test_credits_page(lcd,pad);
//     test.test_loading_menu(lcd);
//     test.test_InstructionsMenu(pad,lcd);
//     test.test_Game_Loop(pad,lcd);
//     test.test_Joystick_position(pad);
//     test.test_Generate_New_Enemy();
//     test.test_Joystick_position(pad);
//     test_check_button_pressed(pad,lcd);
      test.test_accelerometer_position(pad);
     }
    
    
    

}

Definition at line 62 of file tests.h.


Constructor & Destructor Documentation

tests (  )

Default Constructor.

Creates the object of class tests

Definition at line 5 of file tests.cpp.

~tests (  )

Default destructor.

destroys the object of class tests

Definition at line 9 of file tests.cpp.


Member Function Documentation

bool test_accelerometer_position ( Gamepad pad )

method to test the position of the accelerometer and prints its current state and return true

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method
Returns:
true if the condition is met, false otherwise

Definition at line 90 of file tests.cpp.

bool test_check_button_pressed ( Gamepad pad,
N5110 lcd 
)

method to test button presses in the menu and return true, false otherwise

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method
lcdcalls the lcd object to be passed to the methods called inside this method
Returns:
true if the condition is met, false otherwise

Definition at line 109 of file tests.cpp.

void test_credits_page ( N5110 lcd,
Gamepad pad 
)

method to test the credits page on the menu

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method
lcdcalls the lcd object to be passed to the methods called inside this method

Definition at line 33 of file tests.cpp.

void test_drawMenu ( N5110 lcd,
Gamepad pad 
)

method to test the draw main menu method

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method
lcdcalls the lcd object to be passed to the methods called inside this method

Definition at line 29 of file tests.cpp.

void test_End_Game_Melody ( Gamepad pad )

method to test tones played in the game over screen

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method

Definition at line 24 of file tests.cpp.

void test_Game_Loop ( Gamepad pad,
N5110 lcd 
)

method to test the game loop which has all the game methods calls in it

Parameters:
lcdcalls the lcd object to be passed to the methods called inside this method
padcalls the Gamepad object to be passed to the methods called inside this method

Definition at line 81 of file tests.cpp.

bool test_Generate_New_Enemy (  )

method to test generated numbers

it tests if the randomly genrated number is 1,2 or 3

Returns:
true if the condition is met, false otherwise

Definition at line 68 of file tests.cpp.

void test_InstructionsMenu ( Gamepad pad,
N5110 lcd 
)

method to test the instructions page

Parameters:
lcdcalls the lcd object to be passed to the methods called inside this method
padcalls the Gamepad object to be passed to the methods called inside this method

Definition at line 43 of file tests.cpp.

bool test_Joystick_position ( Gamepad pad )

method to test the position of the joystick and prints its current state and return true

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method

Definition at line 48 of file tests.cpp.

void test_loading_menu ( N5110 lcd )

method to test the loading page

Parameters:
lcdcalls the lcd object to be passed to the methods called inside this method

Definition at line 38 of file tests.cpp.

void test_Play_Welcome_Melody ( Gamepad pad )

method to test tones played in the game

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method

Definition at line 19 of file tests.cpp.

void test_welcomeMenu ( Gamepad pad,
N5110 lcd 
)

method to test welcome menu

Parameters:
padcalls the Gamepad object to be passed to the methods called inside this method
lcdcalls the lcd object to be passed to the methods called inside this method

Definition at line 14 of file tests.cpp.