![]() |
The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
|
Test suite for the Paddle class functionality. More...
#include "../paddle.hpp"
#include "../macros.hpp"
#include <cassert>
#include <iostream>
#include <SDL.h>
Functions | |
void | cleanup_sdl () |
Cleans up SDL resources. | |
int | main () |
Main test runner function. | |
bool | setup_sdl () |
Sets up the SDL environment for tests. | |
void | test_paddle_boundaries () |
Tests the paddle's movement and boundary constraints. | |
void | test_paddle_height_adjustment () |
Tests paddle height adjustment. | |
void | test_paddle_initialization () |
Tests the paddle initialization and constructor. | |
void | test_paddle_inverse_power () |
Tests the inverse power functionality. | |
void | test_paddle_position () |
Tests paddle position setters and getters. | |
void | test_paddle_rectangle () |
Tests the paddle rectangle boundary calculation. | |
void | test_paddle_rendering () |
Tests the paddle rendering functionality. | |
Variables | |
SDL_Renderer * | renderer = nullptr |
SDL_Window * | window = nullptr |
Test suite for the Paddle class functionality.
This file contains unit tests for verifying the proper functionality of our Paddle class, including initialization, movement, rendering, and boundary checks.
void cleanup_sdl | ( | ) |
Cleans up SDL resources.
Destroys the renderer and window, and quits SDL
int main | ( | ) |
Main test runner function.
Executes all Paddle class tests and reports results.
bool setup_sdl | ( | ) |
Sets up the SDL environment for tests.
Initializes SDL, creates a hidden window, and sets up a renderer for testing paddle rendering functionality.
void test_paddle_boundaries | ( | ) |
Tests the paddle's movement and boundary constraints.
Verifies that the paddle movement respects screen boundaries and doesn't allow the paddle to move outside the playable area.
void test_paddle_height_adjustment | ( | ) |
Tests paddle height adjustment.
Verifies that we can properly change the paddle height (important for power-ups that affect paddle size).
void test_paddle_initialization | ( | ) |
Tests the paddle initialization and constructor.
Verifies that paddles are initialized with correct position, dimensions, and side placement.
void test_paddle_inverse_power | ( | ) |
Tests the inverse power functionality.
Verifies that the inverse power effect properly reverses the paddle's control direction.
void test_paddle_position | ( | ) |
Tests paddle position setters and getters.
Ensures we can properly set and retrieve paddle position.
void test_paddle_rectangle | ( | ) |
Tests the paddle rectangle boundary calculation.
Ensures that the collision rectangle is properly calculated for collision detection.
void test_paddle_rendering | ( | ) |
Tests the paddle rendering functionality.
Verifies that the paddle can be rendered without errors.
SDL_Renderer* renderer = nullptr |
SDL_Window* window = nullptr |