Skip to content

Commit

Permalink
catch22
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Feb 17, 2024
1 parent 9c78131 commit be738e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct regex_impl : public regex
DDL_PrimitiveType map_to_primitive_type(std::string_view s, std::error_code &ec) noexcept
{
ec = {};
DDL_PrimitiveType result;
DDL_PrimitiveType result = DDL_PrimitiveType::Char;
if (iequals(s, "char"))
result = DDL_PrimitiveType::Char;
else if (iequals(s, "uchar"))
Expand Down
17 changes: 11 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

find_package(Catch2 QUIET)

if (NOT Catch2_FOUND)
if(NOT Catch2_FOUND)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.9)

FetchContent_MakeAvailable(Catch2)

set(Catch2_VERSION "2.13.9")
Expand All @@ -30,20 +30,25 @@ add_library(test-main OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/test-main.cpp")

target_link_libraries(test-main cifpp::cifpp Catch2::Catch2)

if(${Catch2_VERSION} VERSION_GREATER_EQUAL "3.0.0")
target_compile_definitions(test-main PUBLIC CATCH22=0)
if(${Catch2_VERSION} VERSION_GREATER_EQUAL 3.0.0)
target_compile_definitions(test-main PUBLIC CATCH22=0)
else()
target_compile_definitions(test-main PUBLIC CATCH22=1)
target_compile_definitions(test-main PUBLIC CATCH22=1)
endif()


foreach(CIFPP_TEST IN LISTS CIFPP_tests)
set(CIFPP_TEST "${CIFPP_TEST}-test")
set(CIFPP_TEST_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${CIFPP_TEST}.cpp")

add_executable(
${CIFPP_TEST} ${CIFPP_TEST_SOURCE} $<TARGET_OBJECTS:test-main>)

if(${Catch2_VERSION} VERSION_GREATER_EQUAL 3.0.0)
target_compile_definitions(${CIFPP_TEST} PUBLIC CATCH22=0)
else()
target_compile_definitions(${CIFPP_TEST} PUBLIC CATCH22=1)
endif()

target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp::cifpp
Catch2::Catch2)
target_include_directories(${CIFPP_TEST} PRIVATE "${EIGEN_INCLUDE_DIR}")
Expand Down
2 changes: 2 additions & 0 deletions test/test-main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define CATCH_CONFIG_RUNNER 1

#include "test-main.hpp"

#include <cif++.hpp>
Expand Down

0 comments on commit be738e7

Please sign in to comment.