![]() |
The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
|
Test suite for the Letter class functionality. More...
#include "../letter.hpp"#include "../user.hpp"#include "../macros.hpp"#include <cassert>#include <iostream>#include <SDL.h>#include <SDL_ttf.h>Functions | |
| void | cleanup_sdl_ttf () |
| Cleans up SDL and TTF resources. | |
| int | main () |
| Main test runner function. | |
| bool | setup_sdl_ttf () |
| Sets up the SDL and TTF environment for tests. | |
| void | test_letter_collision () |
| Tests the letter collision detection. | |
| void | test_letter_collision_scoring () |
| Tests the letter collision with player scoring. | |
| void | test_letter_initialization () |
| Tests the Letter initialization. | |
| void | test_letter_movement () |
| Tests the letter movement and boundary handling. | |
| void | test_letter_progression () |
| Tests word and letter progression. | |
| void | test_letter_rendering () |
| Tests the letter rendering functionality. | |
Variables | |
| TTF_Font * | font = nullptr |
| SDL_Renderer * | renderer = nullptr |
| SDL_Window * | window = nullptr |
Test suite for the Letter class functionality.
Unit tests for verifying the proper functionality of our Letter class, including initialization, movement, collision detection, and word progression.
| void cleanup_sdl_ttf | ( | ) |
Cleans up SDL and TTF resources.
Destroys the font, renderer, the SDL window, and it quits the TTF and SDL libraries
| int main | ( | ) |
Main test runner function.
Executes all Letter class tests and reports results.
| bool setup_sdl_ttf | ( | ) |
Sets up the SDL and TTF environment for tests.
Initializes SDL and TTF, creates a hidden window, and sets up a renderer and font for testing letter functionality.
| void test_letter_collision | ( | ) |
Tests the letter collision detection.
Ensures the collision detection correctly identifies when a ball intersects with the letter boundaries.
| void test_letter_collision_scoring | ( | ) |
Tests the letter collision with player scoring.
Ensures that when a letter collides with the ball, the appropriate player gets points and the letter advances.
| void test_letter_initialization | ( | ) |
Tests the Letter initialization.
Verifies that a letter is correctly initialized with the provided position, speed, and initial word/letter selection.
| void test_letter_movement | ( | ) |
Tests the letter movement and boundary handling.
Verifies that letters move correctly according to their speed and respect screen boundaries by bouncing.
| void test_letter_progression | ( | ) |
Tests word and letter progression.
Checks that next_letter() and next_word() correctly advance to subsequent letters and words.
| void test_letter_rendering | ( | ) |
Tests the letter rendering functionality.
Verifies that the letter can be rendered without errors.
| TTF_Font* font = nullptr |
| SDL_Renderer* renderer = nullptr |
| SDL_Window* window = nullptr |