Skip to content

Add unit tests for vector operations#163

Open
jasveena15 wants to merge 1 commit intothoth-tech:mainfrom
jasveena15:feature/unit-test-vector
Open

Add unit tests for vector operations#163
jasveena15 wants to merge 1 commit intothoth-tech:mainfrom
jasveena15:feature/unit-test-vector

Conversation

@jasveena15
Copy link
Copy Markdown

Description

Added a new vector unit test suite for SplashKit Core.

This PR introduces unit tests for core vector functionality in unit_test_vector.cpp. The tests validate vector creation, vector arithmetic operations, vector properties, and helper utility functions.

The following functionality is tested:

  • vector creation
  • vector addition
  • vector subtraction
  • vector multiplication
  • vector equality checks
  • dot product calculations
  • vector magnitude
  • vector magnitude squared
  • unit vector generation
  • zero vector detection
  • vector string conversion

These tests improve confidence in the correctness and stability of SplashKit's vector mathematics functionality.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Tested by rebuilding the project and running both the interactive test application and automated unit test suites.

Commands used:

cd ~/splashkit-core/projects/cmake
cmake -G "Unix Makefiles" .
make

cd ~/splashkit-core/bin

./sktest

./skunit_tests.exe "*vector*" --success

./skunit_tests.exe --success

All tests passed successfully.

Testing Checklist

  • Tested with sktest
  • Tested with skunit_tests

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have requested a review from ...

Copy link
Copy Markdown

@222448082Ashen 222448082Ashen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the changes in unit_test_vector.cpp. The test coverage is comprehensive and follows the established project structure. The use of Approx for floating-point comparisons is a great addition for precision stability. This PR effectively improves the reliability of our core mathematics module. Approved.

Copy link
Copy Markdown

@kyriesk kyriesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the unit_test_vector.cpp on my local machine using a WSL setup, and all tests passed without issues. The code follows SplashKit’s coding standards and behaves functional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants