Commit Graph

22 Commits

Author SHA1 Message Date
Moritz Klammler
e86d7c3cd3 Remove excess blank lines at end of file 2022-09-29 19:02:52 +02:00
Moritz Klammler
10fd14f8b9 Consistent unit test header inclusion order
This patch consistently changes the inclusion order for unit test files
to the following:

 1. The header of the unit under test (using <> includes).
 2. The unit_test.hpp header (using "" includes).
 3. Any additional auxiliary test headers (using "" includes and sorted alphabetically).
 4. Additional system headers needed for the test (using <> includes and sorted alphabetically).
 5. Conditionally included system headers (using <> includes).

Putting the unit under test's header at the very beginning has the
advantage of also testing that the header is self-contained.  It also
makes it very quick to tell what unit is tested in this file.
2022-09-29 19:02:52 +02:00
Moritz Klammler
81c5ba9082 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.
2022-09-29 19:02:52 +02:00
Moritz Klammler
d7c04ed5ee Factor redundant test boilerplate out into unit_test.hpp helper 2022-09-29 19:02:52 +02:00
Moritz Klammler
fe471bcbe9 Autodetect the best option to use Boost.Test
The conditional inclusion of either the library or the header-only
version of the Boost.Test header wasn't tremendously useful in practice
because the tests/CMakeLists.txt file would unconditionally add compile
definitions to basically fore dynamic linking.

This patch adds feature detection to the tests/CMakeLists.txt file to
determine whether to use dynamic linking, static linking or the
header-only version (in that order of preference, for best performance).

The automatic detection could be overridden if needed by defining the
TOML11_WITH_BOOST_TEST_{HEADER,STATIC,DYNAMIC}
variables on the CMake command line.

While we are at it, instead of having a conditional
#define BOOST_TEST_NO_LIB
in each unit test file, handle this once in the CMakeLists.txt file.
2022-09-29 17:59:28 +02:00
ToruNiina
02fd8a577b feat: workaround __cplusplus problem on MSVC 2021-12-17 22:29:57 +09:00
ToruNiina
21ea4a348d test: explicitly specify template arguments
toml::value is an alias of default parameters, so we need to avoid
conflict of definitions between default and non-default parameters
2021-04-27 13:12:37 +09:00
ToruNiina
c59782d180 fix: remove useless conversions in the test codes 2020-01-13 11:29:17 +09:00
ToruNiina
d9b8582c47 test: add test for toml::get<T>(std::move(v)) 2019-09-01 19:39:37 +09:00
ToruNiina
dd9b04ae3b fix: fix test case name 2019-06-21 16:01:04 +09:00
ToruNiina
2967cebfb3 test: add test to get a toml::value as string_view 2019-04-26 16:31:59 +09:00
ToruNiina
19524dbc4b fix silly typo 2018-12-16 21:13:21 +09:00
ToruNiina
c2e733a65d enable to get toml::value as toml::value 2018-12-16 20:50:40 +09:00
ToruNiina
be1a310ae5 move test for find to get_related 2018-12-13 01:30:06 +09:00
ToruNiina
d370ae7d0d set tm_isdst as negative value 2018-12-13 00:35:43 +09:00
ToruNiina
a19c9b4a39 add test case for find & get 2018-12-12 21:55:11 +09:00
ToruNiina
cfd82c95f0 add test case for getting converted map 2018-12-12 20:32:26 +09:00
ToruNiina
18a22eb3c4 add test cases for datetime variants 2018-12-12 20:28:31 +09:00
ToruNiina
5a20d55dd0 add test for toml::get 2018-12-12 17:23:06 +09:00
ToruNiina
3203d39dad enable toml::get to make static array (like std::array) 2017-05-07 10:40:17 +09:00
ToruNiina
c522186d4c change include file path 2017-04-21 13:15:05 +09:00
ToruNiina
6d643dd70d add test_get 2017-04-20 13:30:11 +09:00