mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Implement GTest and change windows output path
Implement GTest as a testing infrastructure. Make windows output binaries to the build folder instead of the release type folder (potentially issue further down the line) Add a simple unit test for DestroyableComponent
This commit is contained in:
@@ -1,34 +1,21 @@
|
||||
# create the testing file and list of tests
|
||||
create_test_sourcelist (Tests
|
||||
CommonCxxTests.cpp
|
||||
AMFDeserializeTests.cpp
|
||||
TestNiPoint3.cpp
|
||||
TestLDFFormat.cpp
|
||||
TestEncoding.cpp
|
||||
message (STATUS "Testing is enabled. Fetching gtest...")
|
||||
enable_testing()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.12.1
|
||||
)
|
||||
|
||||
# add the executable
|
||||
add_executable (CommonCxxTests ${Tests})
|
||||
target_link_libraries(CommonCxxTests ${COMMON_LIBRARIES})
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# remove the test driver source file
|
||||
set (TestsToRun ${Tests})
|
||||
remove (TestsToRun CommonCxxTests.cpp)
|
||||
FetchContent_MakeAvailable(GoogleTest)
|
||||
include(GoogleTest)
|
||||
|
||||
# Copy test files to testing directory
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/tests/TestBitStreams/AMFBitStreamTest.bin ${PROJECT_BINARY_DIR}/tests/AMFBitStreamTest.bin
|
||||
COPYONLY
|
||||
)
|
||||
message(STATUS "gtest fetched and is now ready.")
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/tests/TestBitStreams/AMFBitStreamUnimplementedTest.bin ${PROJECT_BINARY_DIR}/tests/AMFBitStreamUnimplementedTest.bin
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
# Add all the ADD_TEST for each test
|
||||
foreach (test ${TestsToRun})
|
||||
get_filename_component (TName ${test} NAME_WE)
|
||||
add_test (NAME ${TName} COMMAND CommonCxxTests ${TName})
|
||||
set_property(TEST ${TName} PROPERTY ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
|
||||
endforeach ()
|
||||
# Add the subdirectories
|
||||
add_subdirectory(dCommonTests)
|
||||
add_subdirectory(dGameTests)
|
||||
|
Reference in New Issue
Block a user