Register C++ tests with CTest
This commit is contained in:
1 parent
24f28dd9c8
commit
7a41d1f647
3 files changed
+18
-5
No files matched your search
@@ -66,11 +66,7 @@ jobs:
|
|||||||
run: lake env lean --run cpp/oracle/gen.lean > cpp/oracle/golden.txt
|
run: lake env lean --run cpp/oracle/gen.lean > cpp/oracle/golden.txt
|
||||||
|
|
||||||
- name: Run C++ tests
|
- name: Run C++ tests
|
||||||
run: |
|
run: ctest --test-dir cpp/build --output-on-failure
|
||||||
cpp/build/golden_test cpp/oracle/golden.txt
|
|
||||||
cpp/build/diff_corpus cpp/oracle/golden.txt
|
|
||||||
cpp/build/extreme_test
|
|
||||||
cpp/build/exhaustive_test
|
|
||||||
|
|
||||||
- name: Check C++ coverage
|
- name: Check C++ coverage
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ endif()
|
|||||||
option(CR_BUILD_FUZZERS "Build libFuzzer differential/safety harnesses" ON)
|
option(CR_BUILD_FUZZERS "Build libFuzzer differential/safety harnesses" ON)
|
||||||
option(CR_BUILD_BENCH "Build the nanobench comparison" ON)
|
option(CR_BUILD_BENCH "Build the nanobench comparison" ON)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
add_library(cr_literal STATIC src/literal.cpp)
|
add_library(cr_literal STATIC src/literal.cpp)
|
||||||
target_include_directories(cr_literal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
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)
|
${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
||||||
target_link_libraries(exhaustive_test PRIVATE cr_literal cr_fast)
|
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)
|
if(CR_BUILD_BENCH)
|
||||||
add_executable(cr_bench tests/bench.cpp)
|
add_executable(cr_bench tests/bench.cpp)
|
||||||
target_include_directories(cr_bench PRIVATE
|
target_include_directories(cr_bench PRIVATE
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++-21
|
|||||||
cmake --build build
|
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
|
## Golden vectors from Lean
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in new issue
Block a user