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
|
2018-12-12 08:23:06 +00:00
|
|
|
test_get
|
2018-12-12 16:30:25 +00:00
|
|
|
test_get_related_func
|
2018-12-12 17:24:03 +00:00
|
|
|
test_from_toml
|
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
|
|
|
|
2017-05-15 09:03:01 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("-Wall" COMPILER_SUPPORTS_WALL)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-Wpedantic" COMPILER_SUPPORTS_WPEDANTIC)
|
|
|
|
|
|
|
|
if(COMPILER_SUPPORTS_WALL)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
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)
|
2017-05-15 09:17:16 +00:00
|
|
|
target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
|
|
|
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)
|