-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add tests via ctest in cmake.
- Loading branch information
Showing
8 changed files
with
170 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const char* kTimestamp = __TIME__; | ||
const char* kDatestamp = __DATE__; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
project(test_soar | ||
LANGUAGES CXX) | ||
|
||
option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) | ||
|
||
file(GLOB TEST_SOURCES | ||
${CMAKE_CURRENT_SOURCE_DIR}/TestHarness/*.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarHelpers/*.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests/*.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests/wma/*.cpp | ||
) | ||
|
||
file(GLOB TEST_HEADERS | ||
${CMAKE_CURRENT_SOURCE_DIR}/TestHarness/*.hpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarHelpers/*.hpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests/*.hpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests/wma/*.hpp | ||
) | ||
|
||
add_executable(${PROJECT_NAME} TestHarness/testMain.cpp ${TEST_SOURCES}) | ||
target_link_libraries(${PROJECT_NAME} soar_static) | ||
target_compile_features(${PROJECT_NAME} PUBLIC | ||
cxx_std_17 | ||
) | ||
|
||
add_executable(test_external_lib TestExternalLibraryLib.cpp) | ||
target_link_libraries(test_external_lib soar_static) | ||
target_compile_features(test_external_lib PUBLIC | ||
cxx_std_17 | ||
) | ||
|
||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarHelpers | ||
${CMAKE_CURRENT_SOURCE_DIR}/TestHarness | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests | ||
${CMAKE_CURRENT_SOURCE_DIR}/SoarUnitTests/wma | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} test_external_lib | ||
DESTINATION bin) | ||
|
||
install(DIRECTORY SoarTestAgents DESTINATION ${CMAKE_INSTALL_PREFIX}/SoarTestAgents) | ||
install(DIRECTORY SoarTestAgents DESTINATION ${CMAKE_BINARY_DIR}/UnitTests) | ||
|
||
enable_testing() | ||
|
||
# TESTS FROM CI: | ||
if(BUILD_TESTING) | ||
add_test(NAME test_ci COMMAND test_soar -e PRIMS_Sanity1 -e PRIMS_Sanity2 -f testLoadLibrary -f testSmemArithmetic -f testHamilton -E SvsTests -e testCommandToFile) | ||
|
||
if(SVS) | ||
add_test(NAME test_svs COMMAND test_soar -c SvsTests) | ||
endif() | ||
endif() | ||
|
||
if(ENABLE_TEST_COVERAGE) | ||
target_compile_options(soar_static PUBLIC -O0 -g -fprofile-arcs -ftest-coverage) | ||
target_link_options(soar_static PUBLIC -fprofile-arcs -ftest-coverage) | ||
endif() |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[requires] | ||
sqlite3/3.47.0 | ||
sqlite3/3.40.0 | ||
|
||
[generators] | ||
CMakeDeps | ||
|