Add test cases to unit_test_sprites.cpp#164
Open
kyriesk wants to merge 2 commits intothoth-tech:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds comprehensive unit tests for three collision-related functions in the sprite module that were previously untested in the unit test suite. The tests adapt test scenarios from
test_sprites.cpp(sktest) into proper unit tests using the Catch2 framework.The new tests ensure that:
calculate_collision_directioncorrectly determines the direction of collision between sprites and geometric shapesresolve_collisionproperly resolves collisions by moving objects out of collision statessprite_ray_collisionaccurately detects when sprites intersect with raysFixes #(issue related to missing collision tests)
Type of change
Changes Made
Added 5 new test cases to
coresdk/src/test/unit_tests/unit_test_sprites.cpp:collision direction between sprites (6 sub-tests)
collision direction between sprite and rectangle (2 sub-tests)
collision resolution between sprites (3 sub-tests)
collision resolution between sprite and rectangle (2 sub-tests)
sprite ray collision detection (6 sub-tests)
Added required headers:
collisions.handgeometry.hHow Has This Been Tested?
The tests have been written following the existing patterns in
unit_test_sprites.cppand use:TEST_CASEandSECTIONmacrosREQUIREandREQUIRE_FALSEmacrosAll tests use existing resources (rocket_sprt.png, background.png, frog.png) that are already available in the test resources directory.
All tests were run and verified to pass:
Testing Checklist
Checklist
Additional Notes