mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00

* CI: ctest: fix trigger on CMakeLists change * CI: ctest: update cmake version this removes a warning and matches gtest * CI: ctest: remove explicit build mode for MSVC gtest switched to dynamic libc (/MD), which is default, so this just works now
C++ tests
Test framework for C and C++ code in AP.
Adding a Test
GoogleTest
Adding GoogleTests is as simple as creating a directory with
- one or more
test_*.cpp
files that define tests using GoogleTest API - a
CMakeLists.txt
that adds the .cpp files totest_default
target using target_sources
CTest
If either GoogleTest is not suitable for the test or the build flags / sources / libraries are incompatible,
you can add another CTest to the project using add_target and add_test, similar to how it's done for test_default
.
Running Tests
- Install CMake.
- Build and/or install GoogleTest and make sure
CMake can find it, or
create a parent
CMakeLists.txt
that fetches GoogleTest. - Enter the directory with the top-most
CMakeLists.txt
and runmkdir build cmake -S . -B build/ -DCMAKE_BUILD_TYPE=Release cmake --build build/ --config Release && \ ctest --test-dir build/ -C Release --output-on-failure