Honor UNITTEST_FRAMEWORK_LIBRARY_EXIST in all unit test files

Most unit test files checked UNITTEST_FRAMEWORK_LIBRARY_EXIST and
adapted themselves accordingly to either use the header-only version or
link with the library.  Alas, eight files didn't so the project couldn't
really be tested with the header-only version of that Boost library.

This patch adds the missing pre-processor logic to the files that were
missing it.  The style of using no indentation after the '#' was
followed from the existing unit test files.  Some other files in this
repository do indent their pre-processor logic, though.

Since replicating the conditional in every file is kind of verbose,
tedious and, apparently, easily forgotten, I'm wondering whether
isolating that logic into a tiny little auxiliary header and then
unconditionally including that one in each unit test file would be a
good idea, though.
This commit is contained in:
Moritz Klammler 2022-09-15 19:54:27 +02:00
parent cf8a977be2
commit 5312b8eb0e
8 changed files with 40 additions and 0 deletions

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_lex_boolean"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_lex_datetime"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_lex_floating"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include <limits>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_lex_integer"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "lex_key_comment_test"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_lex_string"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_result"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <iostream>
#include <toml/result.hpp>

View File

@ -1,5 +1,10 @@
#define BOOST_TEST_MODULE "test_string"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml.hpp>
BOOST_AUTO_TEST_CASE(test_basic_string)