#define BOOST_TEST_MODULE "test_acceptor" #ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST #include #else #define BOOST_TEST_NO_LIB #include #endif #include #include #include BOOST_AUTO_TEST_CASE(test_try_reserve) { { // since BOOST_TEST is a macro, it cannot handle commas correctly. // When toml::detail::has_reserve_method>::value // is passed to a macro, C preprocessor considers // toml::detail::has_reserve_method>::value as the second argument. We need an alias to avoid // this problem. using reservable_type = std::vector ; using nonreservable_type = std::array; BOOST_TEST( toml::detail::has_reserve_method::value); BOOST_TEST(!toml::detail::has_reserve_method::value); } { std::vector v; toml::try_reserve(v, 100); BOOST_TEST(v.capacity() == 100u); } } BOOST_AUTO_TEST_CASE(test_concat_to_string) { const std::string cat = toml::concat_to_string("foo", "bar", 42); BOOST_TEST(cat == "foobar42"); } BOOST_AUTO_TEST_CASE(test_from_string) { { const std::string str("123"); BOOST_TEST(toml::from_string(str, 0) == 123); } { const std::string str("01"); BOOST_TEST(toml::from_string(str, 0) == 1); } }