2017-04-19 13:47:40 +00:00
|
|
|
set(TEST_NAMES
|
2018-12-11 12:51:39 +00:00
|
|
|
test_datetime
|
|
|
|
test_utility
|
|
|
|
test_result
|
|
|
|
test_traits
|
|
|
|
test_value
|
2018-12-04 11:30:21 +00:00
|
|
|
test_lex_boolean
|
|
|
|
test_lex_integer
|
|
|
|
test_lex_floating
|
|
|
|
test_lex_datetime
|
|
|
|
test_lex_string
|
|
|
|
test_lex_key_comment
|
2018-12-11 12:51:39 +00:00
|
|
|
test_parse_boolean
|
|
|
|
test_parse_integer
|
|
|
|
test_parse_floating
|
2018-12-11 14:25:44 +00:00
|
|
|
test_parse_string
|
2018-12-12 11:55:30 +00:00
|
|
|
test_parse_datetime
|
2018-12-11 14:31:24 +00:00
|
|
|
test_parse_array
|
2018-12-13 04:07:48 +00:00
|
|
|
test_parse_table
|
2018-12-11 14:38:57 +00:00
|
|
|
test_parse_inline_table
|
2018-12-11 14:25:44 +00:00
|
|
|
test_parse_key
|
2018-12-11 16:31:36 +00:00
|
|
|
test_parse_table_key
|
2019-03-19 15:36:46 +00:00
|
|
|
test_literals
|
2019-06-15 08:13:25 +00:00
|
|
|
test_comments
|
2018-12-12 08:23:06 +00:00
|
|
|
test_get
|
2019-06-22 07:39:01 +00:00
|
|
|
test_get_or
|
2019-06-20 05:34:14 +00:00
|
|
|
test_find
|
2019-06-22 07:58:45 +00:00
|
|
|
test_find_or
|
2019-06-22 07:59:21 +00:00
|
|
|
test_expect
|
2018-12-12 17:26:55 +00:00
|
|
|
test_parse_file
|
2019-02-13 04:51:36 +00:00
|
|
|
test_serialize_file
|
2018-12-12 17:28:52 +00:00
|
|
|
test_parse_unicode
|
2018-12-22 08:43:42 +00:00
|
|
|
test_error_detection
|
2019-03-15 03:40:01 +00:00
|
|
|
test_format_error
|
2019-03-16 06:46:21 +00:00
|
|
|
test_extended_conversions
|
2018-12-22 08:43:42 +00:00
|
|
|
)
|
2017-04-19 13:47:40 +00:00
|
|
|
|
2019-06-20 15:29:45 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("-Wall" COMPILER_SUPPORTS_WALL)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-Wextra" COMPILER_SUPPORTS_WEXTRA)
|
2017-05-15 09:03:01 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("-Wpedantic" COMPILER_SUPPORTS_WPEDANTIC)
|
|
|
|
|
|
|
|
if(COMPILER_SUPPORTS_WALL)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
endif()
|
2019-06-20 15:29:45 +00:00
|
|
|
if(COMPILER_SUPPORTS_WEXTRA)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
|
|
|
endif()
|
2017-05-15 09:03:01 +00:00
|
|
|
if(COMPILER_SUPPORTS_WPEDANTIC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
|
|
|
endif()
|
2017-04-19 13:47:40 +00:00
|
|
|
|
2017-05-15 09:38:46 +00:00
|
|
|
# Disable some MSVC warnings
|
|
|
|
if(MSVC)
|
|
|
|
# conversion from 'double' to 'unsigned int', possible loss of data
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244")
|
|
|
|
# conversion from 'int' to 'unsigned int', signed/unsigned mismatch
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4365")
|
|
|
|
# layout of class may have changed from a previous version of the compiler
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4371")
|
|
|
|
# enumerator in switch of enum is not explicitly handled by a case label
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4061")
|
|
|
|
# unreferenced inline function has been removed
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4514")
|
|
|
|
# constructor is not implicitly called
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4582")
|
|
|
|
# destructor is not implicitly called
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4583")
|
|
|
|
# pragma warning: there is no warning number <x>
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4619")
|
|
|
|
# default constructor was implicitly defined as deleted
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4623")
|
|
|
|
# copy constructor was implicitly defined as deleted
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4625")
|
|
|
|
# assignment operator was implicitly defined as deleted
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4626")
|
|
|
|
# move assignment operator was implicitly defined as deleted
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4627")
|
|
|
|
# <X> is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4668")
|
|
|
|
# function not inlined
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4710")
|
|
|
|
# function selected for automatic inlining
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4711")
|
|
|
|
# <x> bytes padding added after data member
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4820")
|
|
|
|
# pragma warning(pop): likely mismatch, popping warning state pushed in different file
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5031")
|
|
|
|
endif()
|
|
|
|
|
2017-05-15 09:17:16 +00:00
|
|
|
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
|
|
|
|
add_definitions(-DBOOST_TEST_DYN_LINK)
|
|
|
|
add_definitions(-DUNITTEST_FRAMEWORK_LIBRARY_EXIST)
|
2017-04-19 13:47:40 +00:00
|
|
|
|
|
|
|
foreach(TEST_NAME ${TEST_NAMES})
|
|
|
|
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
|
2019-06-14 15:24:21 +00:00
|
|
|
target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} toml11::toml11)
|
2017-05-15 09:17:16 +00:00
|
|
|
target_include_directories(${TEST_NAME} PRIVATE ${Boost_INCLUDE_DIRS})
|
2017-05-15 09:18:43 +00:00
|
|
|
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
2017-05-15 12:00:51 +00:00
|
|
|
|
|
|
|
# Set the PATH to be able to find Boost DLL
|
|
|
|
if(WIN32)
|
|
|
|
STRING(REPLACE ";" "\\;" PATH_STRING "$ENV{PATH}")
|
|
|
|
set_tests_properties(${TEST_NAME}
|
|
|
|
PROPERTIES ENVIRONMENT "PATH=${PATH_STRING}\;${Boost_LIBRARY_DIRS}"
|
|
|
|
)
|
|
|
|
endif()
|
2017-04-19 13:47:40 +00:00
|
|
|
endforeach(TEST_NAME)
|
2019-03-18 03:39:58 +00:00
|
|
|
|
|
|
|
# this test is to check it compiles. it will not run
|
|
|
|
add_executable(test_multiple_translation_unit
|
|
|
|
test_multiple_translation_unit_1.cpp
|
|
|
|
test_multiple_translation_unit_2.cpp)
|
2019-06-19 07:53:45 +00:00
|
|
|
target_link_libraries(test_multiple_translation_unit toml11::toml11)
|