57 lines
1.2 KiB
CMake
57 lines
1.2 KiB
CMake
include(FetchContent)
|
|
|
|
# Fetch Google Test
|
|
FetchContent_Declare(
|
|
googletest
|
|
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
|
|
URL_HASH SHA256=8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7
|
|
)
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
set(TEST_SOURCES
|
|
test_main.cpp
|
|
test_wfc.cpp
|
|
test_grid.cpp
|
|
test_wave.cpp
|
|
test_propagator.cpp
|
|
)
|
|
|
|
# Create test executable
|
|
add_executable(nd-wfc-tests ${TEST_SOURCES})
|
|
|
|
# Include directories
|
|
target_include_directories(nd-wfc-tests
|
|
PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
|
)
|
|
|
|
# Link libraries
|
|
target_link_libraries(nd-wfc-tests
|
|
PRIVATE
|
|
nd-wfc
|
|
gtest_main
|
|
gtest
|
|
)
|
|
|
|
# Set C++ standard
|
|
set_target_properties(nd-wfc-tests PROPERTIES
|
|
CXX_STANDARD 17
|
|
CXX_STANDARD_REQUIRED ON
|
|
)
|
|
|
|
# Register tests with CTest
|
|
include(GoogleTest)
|
|
gtest_discover_tests(nd-wfc-tests
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
PROPERTIES
|
|
TIMEOUT 60
|
|
)
|
|
|
|
# Add test target to run all tests
|
|
add_custom_target(run-tests
|
|
COMMAND nd-wfc-tests
|
|
DEPENDS nd-wfc-tests
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
)
|