Feature/test api implementation#20
Merged
Merged
Conversation
- Add Test project to main.sharpmake.cs with RenderSystem dependency - Create Defines.h for Test project - Update main.cpp with basic console app entry point - Add Test to SpectrumSolution configuration - Regenerate Visual Studio projects Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add Test:Framework module with TestRegistry for test management - Implement assertion macros: ASSERT_TRUE, ASSERT_FALSE, ASSERT_EQ, ASSERT_NE - Create TEST() macro for easy test registration - Add test runner in main() that executes all registered tests - Provide formatted pass/fail reporting with file/line information - No external dependencies, pure C++23 modules Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Test project is a console application, not a Windows GUI app. Remove Windows subsystem and add Console subsystem in configuration. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Switch from console main() to WinMain for D3D12 window/swapchain creation. Keep Windows subsystem in linker configuration. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Follow the pattern used by other layers in the codebase. Document Test as the test layer and chain to Spectrum/Defines.h. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Create Test.Math module with simple arithmetic test cases - Tests: Addition, Subtraction, Multiplication, Division, FloatingPoint, Comparison - Import Test.Math in main.cpp to register tests - Regenerate project files Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Import Core module in TestFramework - Replace std::cout with Log::get() for all test output - Use Log::LEVEL_INFO for passed tests and summary - Use Log::LEVEL_ERROR for failed tests and error details - Remove iostream dependency Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Log test suite start with test count - Log each test as it runs - Log individual pass/fail results immediately - Add final summary with total/passed/failed counts - Use LEVEL_ERROR for failed test count if any failures Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add SetupLogging() to initialize Log listeners (WinErrorLogger, FileTXTLogger, VSOutputLogger) - Create test.log file for test output - Set logging level to LEVEL_ALL for full visibility - Call SetupLogging() at start of WinMain before running tests Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove redundant newlines and indentation from log messages - Simplify output format: show [PASS]/[FAIL] directly without "Running:" prefix - Align error messages with proper spacing - Clean up summary box formatting Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Log "Test application started" immediately after logging init to detect early crashes. Log "Test application finished" at the end to verify normal completion. These markers help diagnose crashes that occur before/during test execution. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Each test now logs '>> Starting: TestName' before execution. If a test crashes, its startup message will be visible but no [PASS]/[FAIL] result. This lets you identify exactly which test is crashing. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Create Test.Core module with vector/matrix tests - Test vec2: creation, addition, subtraction, dot product - Test vec3: creation, addition, cross product, dot product, magnitude - Test vec4: creation, addition - Test mat4x4: identity, translation, scale - Import Test.Core in main.cpp to register tests Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Use static functions: vec2::dot(), vec3::cross(), vec3::dot() - Fix matrix element access: use a11/a22 instead of _11/_22 - Fix identity() call: m.identity() is a member function - Use global translation() function instead of member - Add Vector3_Normalize test - Remove untested scale() function Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Extend TEST macro to support TEST(category, name) format - Update TestResult struct to include category field - Update TestRegistry to handle category registration - Group tests by category in output - Show per-category statistics in summary - Format test names as Category::TestName in logs Updated all tests to use hierarchy: - Arithmetic: basic math tests - Core.Vectors: vector operation tests - Core.Matrices: matrix operation tests Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add Test/Defines.h to module preambles in: - TestFramework.ixx - Core.Tests.ixx - Math.Tests.ixx This ensures defines chain properly through modules, following the established pattern from other layers. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- TestFramework.ixx → Test.Framework.ixx - Math.Tests.ixx → Test.Math.ixx - Core.Tests.ixx → Test.Core.ixx Aligns with codebase naming pattern (e.g., HAL.Device.ixx). Module exports already use correct dot notation.
Sharpmake automatically handles forced includes via the ForcedIncludes configuration. Removing redundant manual includes from module preambles.
Macros must be in header files, not modules, to work correctly at preprocessing time. Moved: - TEST(category, name) - ASSERT_TRUE - ASSERT_FALSE - ASSERT_EQ - ASSERT_NE From Test.Framework.ixx to Test/Defines.h
Use indirection (CONCAT_IMPL calling CONCAT) to force __LINE__ expansion before token pasting. This ensures unique function names for each test without conflicts. - test_12, test_19, test_27, etc based on line numbers - Avoids duplicate symbol errors between files
Move files to separate concerns: - Root: main.cpp, Defines.h - TestFramework/: Test.Framework.ixx (test infrastructure) - Tests/: Test.Math.ixx, Test.Core.ixx (actual test implementations) Improves organization and makes it easy to add more test modules.
- Quaternion: creation, conjugate, identity multiplication - AABB: creation, center calculation, size calculation - Sphere: creation, point containment checks - Ray: creation, point-at calculation - Intersections: ray-sphere, AABB point containment, AABB overlap Covers extended math functionality beyond basic vectors/matrices.
Use Core type naming convention: - quat → Quat - aabb → AABB - sphere → Sphere - ray → Ray
The Core type is 'quat' (lowercase), not 'Quat'. Verified against Core/Math/Types/Quaternion.ixx
- Update Sphere tests to use 'pos' member instead of 'center' - Update Ray tests to use 'pos' and 'dir' members instead of 'origin' and 'direction' - Add AABB constructor accepting (vec3 min, vec3 max) - Add AABB::center() method - Add AABB::size() method Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Correct quat constructor parameter order: x, y, z, w (not w, x, y, z) - Fix Creation test to verify identity quaternion components in correct order - Fix Conjugate test to verify imaginary parts negated, real part preserved - Fix Identity test to use proper identity quaternion (0, 0, 0, 1) - Fix TestRegistry to catch TestFailure exception instead of std::string Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Basic type serialization tests (int, float, string, vec3) - Round-trip tests verifying serialize/deserialize data integrity - Complex object tests with SimpleData and NestedData structs - Inheritance tests with BaseEntity and DerivedEntity - Composition tests with GameObject containing Component - Data integrity tests for edge cases and large values - Support for inheritance hierarchies with SAVE_PARENT macro All 60 serialization tests passing including: - Core.Serialization tests (20 tests) - Core math and geometry tests (40 tests) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Build category stats message with stringstream before logging to avoid extra blank lines from multiple Log::get() calls. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Thread pool task execution (8 tests): simple, multiple, void, string, float, vec3 tasks - Concurrent execution tests with atomics and futures - Scheduler tests: immediate and delayed task execution - Synchronization primitives (7 tests): SpinLock, Lockable guards - Concurrent access protection and atomic operations - Thread-local storage behavior - Multiple return type support (void, int, bool, string) - Exception handling and propagation from tasks All threading tests integrated and ready to run. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Event Registration & Firing (6 tests): - Simple registration and event firing - Multiple handler registration (3 handlers per event) - Variadic arguments (int, float, string) - Vector and custom type support Handler Callbacks & Invocation (5 tests): - Sequential callback invocation - Handler unregistration - Multiple sequential invocations - Handler variable capture - Void events Event Propagation (9 tests): - Multi-handler propagation with different processing - Multi-argument aggregation - Event chaining (event1 → event2) - Thread-safe propagation (5 handlers) - Complex event flows with logging Runner & Async Tests (4 tests): - Basic runner-based event firing - Multiple handlers with runner - Event accumulation with runner - Multiple processing cycles Multi-threaded Events (6 tests): - Concurrent firing from 10 threads - Multiple threads with multiple handlers - Data aggregation from thread pool (sum 1-10) - Concurrent firing and handling - Thread pool event chaining - Runner with thread pool async execution - Complex producer/worker async event flow Total: 30 event tests covering sync, async, threading, and data flow scenarios. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Tests for event handlers registered on class instances: - ClassEventHandlerRegistration: Basic class inheriting from prop_handler - ClassEventHandlerDestruction: Verifies cleanup when listener goes out of scope - MultipleClassHandlers: Multiple listener classes on same event - ClassHandlerWithMultipleEvents: One listener handling multiple events - ClassHandlerScopedLifetime: Confirms handlers unregistered on destruction - ClassHandlerThreadedRegistration: Concurrent firing from thread pool - ClassHandlerAutomaticCleanup: RAII pattern unregistration via destructor All tests verify: ✓ Proper handler registration on class instances ✓ No crashes or use-after-free when listeners destroyed ✓ Automatic handler cleanup via RAII pattern ✓ Thread-safe handler invocation with class objects ✓ Multiple listeners managing independent state Test suite now at 114 total tests (35 event tests): - Event registration, firing, propagation (20 tests) - Runner & async execution (4 tests) - Multi-threaded events (6 tests) - Class-based handlers (5 tests) 100% pass rate maintained. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Created Test.FileSystem.ixx with 21 filesystem tests covering: - File I/O: SaveAndLoadString, SaveAndLoadMultilineText, SaveLargeFile, FileExistence - Path handling: PathExtension, PathFilename, PathParent, PathCombine, PathAbsolute, PathRelative, PathComparison - Directory operations: CreateDirectory, CreateNestedDirectories, ListDirectoryFiles, ListDirectories, RecursiveDirectoryIteration, DirectorySize, DeleteFile, RenameFile, CopyFile, FileSize All tests pass with native_file_provider registered at module initialization. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Created Test.Profiling.ixx with 19 profiling tests covering: - Performance counter collection: CPUCounter creation and time measurement - Timing measurements: Timer basic functionality, elapsed time, nested timers - Profiling data accumulation: Multiple scopes, deep nesting, block hierarchy - Additional: Profiler state management, ScopedCounter, thread-local storage Tests verify correct behavior of Timer, TimedBlock, CPUCounter, and Profiler systems. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
No description provided.