Add pure game model + GTest board tests and scaffolding
Add SDL-free Board model: Board.h, Board.cpp Add unit tests for Board using Google Test: test_board.cpp Integrate test_board into CMake and register with CTest: update CMakeLists.txt Add gtest to vcpkg.json so CMake can find GTest Add high-level refactor plan: plan-spacetrisRefactor.prompt.md Update internal TODOs to mark logic extraction complete This scaffolds deterministic, testable game logic and CI-friendly tests without changing existing runtime behavior.
This commit is contained in:
@ -201,6 +201,20 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
|
||||
target_include_directories(spacetris_tests PRIVATE "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
|
||||
endif()
|
||||
|
||||
# GoogleTest-based board unit tests
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
add_executable(test_board
|
||||
tests/test_board.cpp
|
||||
src/logic/Board.cpp
|
||||
)
|
||||
target_include_directories(test_board PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
target_link_libraries(test_board PRIVATE GTest::gtest_main)
|
||||
add_test(NAME BoardTests COMMAND test_board)
|
||||
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
|
||||
target_include_directories(test_board PRIVATE "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/include")
|
||||
endif()
|
||||
|
||||
# Add new src subfolders to include path so old #includes continue to work
|
||||
target_include_directories(spacetris PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
|
||||
Reference in New Issue
Block a user