Register C++ tests with CTest

This commit is contained in:
andrew committed 2026-11-18 11:31:51 -05:00
1 parent 24f28dd9c8
commit 7a41d1f647
3 files changed
+18 -5

No files matched your search

+1 -5
View File
@@ -66,11 +66,7 @@ jobs:
run: lake env lean --run cpp/oracle/gen.lean > cpp/oracle/golden.txt
- name: Run C++ tests
run: |
cpp/build/golden_test cpp/oracle/golden.txt
cpp/build/diff_corpus cpp/oracle/golden.txt
cpp/build/extreme_test
cpp/build/exhaustive_test
run: ctest --test-dir cpp/build --output-on-failure
- name: Check C++ coverage
run: |
+8
View File
@@ -12,6 +12,8 @@ endif()
option(CR_BUILD_FUZZERS "Build libFuzzer differential/safety harnesses" ON)
option(CR_BUILD_BENCH "Build the nanobench comparison" ON)
enable_testing()
add_library(cr_literal STATIC src/literal.cpp)
target_include_directories(cr_literal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
@@ -41,6 +43,12 @@ target_include_directories(exhaustive_test PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/tests)
target_link_libraries(exhaustive_test PRIVATE cr_literal cr_fast)
set(CR_GOLDEN_VECTORS "${CMAKE_CURRENT_SOURCE_DIR}/oracle/golden.txt")
add_test(NAME golden COMMAND golden_test "${CR_GOLDEN_VECTORS}")
add_test(NAME diff_corpus COMMAND diff_corpus "${CR_GOLDEN_VECTORS}")
add_test(NAME extreme COMMAND extreme_test)
add_test(NAME exhaustive COMMAND exhaustive_test)
if(CR_BUILD_BENCH)
add_executable(cr_bench tests/bench.cpp)
target_include_directories(cr_bench PRIVATE
+9
View File
@@ -62,6 +62,15 @@ cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++-21
cmake --build build
```
Run the registered tests with CTest:
```sh
ctest --test-dir build --output-on-failure
```
`golden` and `diff_corpus` read `oracle/golden.txt`; regenerate it first if it
is missing (see below).
## Golden vectors from Lean
```sh