R-Type  2
Doom but in better
Loading...
Searching...
No Matches
Tests.cpp File Reference
#include "Tests.hpp"
Include dependency graph for Tests.cpp:

Go to the source code of this file.

Functions

void printMessage (GameMessage &msg)
 
void cleanup (void)
 Cleans up any resources or states after tests.
 
int test_zipper (void)
 Test the functionality of the Zipper class.
 
int test_indexed_zipper (void)
 Test the functionality of the IndexedZipper class.
 
int test_create_registry (void)
 Test function for creating a registry.
 
int test_run_systems (void)
 Test function for running systems within the registry.
 
int test_create_game (void)
 Test function for creating a game.
 
int test_run_update (void)
 Test function for running the game's update cycle.
 
int test_get_game_event (void)
 Test retrieving game events from the Game instance.
 
int test_send_msg (void)
 Test sending a message to the Game instance.
 
int test_stress (void)
 Test for stress and performance.
 

Variables

EventDispatcherev = nullptr
 
Registryr = nullptr
 
Gameg = nullptr
 
Queueq = nullptr
 

Function Documentation

◆ cleanup()

void cleanup ( void )

Cleans up any resources or states after tests.

The cleanup function is used to reset or clean up any resources or global states after the tests have been run. This ensures that each test is isolated and doesn't interfere with others.

Definition at line 48 of file Tests.cpp.

◆ printMessage()

void printMessage ( GameMessage & msg)
inline

Definition at line 8 of file Tests.cpp.

◆ test_create_game()

int test_create_game ( void )

Test function for creating a game.

The test_create_game function tests the initialization of a game, ensuring that all game components are properly set up and ready for use.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 134 of file Tests.cpp.

◆ test_create_registry()

int test_create_registry ( void )

Test function for creating a registry.

The test_create_registry function tests the creation of a registry object, verifying its initialization and ensuring that it functions as expected.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 104 of file Tests.cpp.

◆ test_get_game_event()

int test_get_game_event ( void )

Test retrieving game events from the Game instance.

This test ensures that the Game object updates correctly and retrieves game events. It deserializes each event and prints its type and ID to verify the functionality.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 162 of file Tests.cpp.

◆ test_indexed_zipper()

int test_indexed_zipper ( void )

Test the functionality of the IndexedZipper class.

This test verifies that the IndexedZipper class correctly zips two vectors containing optional values, along with their respective indices. The test iterates through the zipped tuples and checks if the values match.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 82 of file Tests.cpp.

◆ test_run_systems()

int test_run_systems ( void )

Test function for running systems within the registry.

The test_run_systems function tests the execution of various systems within the registry, ensuring that the systems interact correctly with the components and entities.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 119 of file Tests.cpp.

◆ test_run_update()

int test_run_update ( void )

Test function for running the game's update cycle.

The test_run_update function tests the game's update logic, simulating a game loop and verifying that game states and entities are correctly updated.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 147 of file Tests.cpp.

◆ test_send_msg()

int test_send_msg ( void )

Test sending a message to the Game instance.

This test verifies that a message can be serialized, sent to the Game instance, and processed correctly. The Game object updates, retrieves game events, and deserializes them to validate the process.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure)..

Definition at line 183 of file Tests.cpp.

◆ test_stress()

int test_stress ( void )

Test for stress and performance.

This test verifies if the game loop doesn't break or is too slow.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure)...

Definition at line 210 of file Tests.cpp.

◆ test_zipper()

int test_zipper ( void )

Test the functionality of the Zipper class.

This test verifies that the Zipper class correctly zips two vectors containing optional values. The test iterates through the zipped pairs and checks if the values match.

Returns
An integer indicating the result of the test (e.g., 0 for success, non-zero for failure).

Definition at line 60 of file Tests.cpp.

Variable Documentation

◆ ev

EventDispatcher* ev = nullptr

Definition at line 3 of file Tests.cpp.

◆ g

Game* g = nullptr

Definition at line 5 of file Tests.cpp.

◆ q

Queue* q = nullptr

Definition at line 6 of file Tests.cpp.

◆ r

Registry* r = nullptr

Definition at line 4 of file Tests.cpp.