Define BOOST_TEST_MODULE in CMake

This removes one #define from each unit test file and ensures
consistency between file and module names.  This consistency, was not
strictly maintained before.  I hope that any discrepancies were
unintentional and that a 1:1 mapping is actually what is desired.

Since the definition is now done at one single place, it would be easy
to apply transformations like removing the 'test_' prefix or replacing
'_' with '-' if this should be desired.
This commit is contained in:
Moritz Klammler 2022-09-16 13:04:29 +02:00
parent d7c04ed5ee
commit 81c5ba9082
37 changed files with 1 additions and 36 deletions

View File

@ -248,6 +248,7 @@ foreach(TEST_NAME ${TEST_NAMES})
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} toml11::toml11)
target_include_directories(${TEST_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS})
target_compile_definitions(${TEST_NAME} PRIVATE "BOOST_TEST_MODULE=\"${TEST_NAME}\"")
# to compile tests with <filesystem>...
if(TOML11_REQUIRE_FILESYSTEM_LIBRARY)

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_comments"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_datetime"
#include "unit_test.hpp"
#include <toml/datetime.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_error_detection"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_expect"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_extended_conversions"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_find"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_find_or"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_find_or_recursive"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_format_error"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_get"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_get_or"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_lex_boolean"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_lex_datetime"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_lex_floating"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_lex_integer"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "lex_key_comment_test"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_lex_string"
#include "unit_test.hpp"
#include <toml/lexer.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_literals"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_array<toml::value>_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_parse_boolean"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_datetime_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_parse_file"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_floating_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_inline_table_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_integer_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_key_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_string_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_table_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "parse_table_key_test"
#include "unit_test.hpp"
#include <toml/parser.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_parse_unicode"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_result"
#include "unit_test.hpp"
#include <iostream>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_serialize_file"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_string"
#include "unit_test.hpp"
#include <toml.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_traits"
#include "unit_test.hpp"
#include <toml/types.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_acceptor"
#include "unit_test.hpp"
#include <toml/utility.hpp>

View File

@ -1,4 +1,3 @@
#define BOOST_TEST_MODULE "test_value"
#include "unit_test.hpp"
#include <toml.hpp>