Skip to content

Commit

Permalink
Add some catch2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uroni committed Nov 19, 2023
1 parent 697f010 commit 05ab4dc
Show file tree
Hide file tree
Showing 5 changed files with 24,072 additions and 1 deletion.
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(CMAKE_MINOR_VERSION LESS 12)
project(miniz)
# see issue https://gitlab.kitware.com/cmake/cmake/merge_requests/1799
else()
project(miniz C)
project(miniz)
set(CMAKE_C_STANDARD 90)
set(CMAKE_VERBOSE_MAKEFILE ON)
# set(CMAKE_C_VISIBILITY_PRESET hidden)
Expand Down Expand Up @@ -42,6 +42,7 @@ option(BUILD_FUZZERS "Build fuzz targets" OFF)
option(AMALGAMATE_SOURCES "Amalgamate sources into miniz.h/c" OFF)
option(BUILD_HEADER_ONLY "Build a header-only version" OFF)
option(BUILD_SHARED_LIBS "Build shared library instead of static" OFF)
option(BUILD_TESTS "Build tests" ${MINIZ_STANDALONE_PROJECT})
option(INSTALL_PROJECT "Install project" ${MINIZ_STANDALONE_PROJECT})

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
Expand Down Expand Up @@ -296,6 +297,20 @@ if(BUILD_FUZZERS)
target_link_libraries(zip_fuzzer miniz)
endif()

if(BUILD_TESTS)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)

add_executable(catch_tests tests/main.cpp
tests/catch_amalgamated.cpp)
target_link_libraries(catch_tests miniz)

enable_testing()

add_test(NAME catch_tests
COMMAND $<TARGET_FILE:catch_tests>)
endif()

set(INCLUDE_INSTALL_DIR "include")

if(INSTALL_PROJECT)
Expand Down
17 changes: 17 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": 1,
"cmakeMinimumRequired": {
"major": 3,
"minor": 5,
"patch": 0
},
"configurePresets": [
{
"name": "gcc",
"displayName": "GCC",
"description": "Default build options for GCC",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build"
}
]
}
Loading

0 comments on commit 05ab4dc

Please sign in to comment.