From cfd82c95f0d48016a2a4f8843bf370236c2d4ffb Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 12 Dec 2018 20:32:26 +0900 Subject: [PATCH] add test case for getting converted map --- tests/test_get.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_get.cpp b/tests/test_get.cpp index a3b6449..8a01757 100644 --- a/tests/test_get.cpp +++ b/tests/test_get.cpp @@ -251,6 +251,23 @@ BOOST_AUTO_TEST_CASE(test_get_toml_array_of_array) BOOST_CHECK_EQUAL(std::get<1>(t).at(2), "baz"); } +BOOST_AUTO_TEST_CASE(test_get_toml_table) +{ + toml::value v1(toml::table{ + {"key1", 1}, + {"key2", 2}, + {"key3", 3}, + {"key4", 4} + }); + + const auto v = toml::get>(v1); + BOOST_CHECK_EQUAL(v.at("key1"), 1); + BOOST_CHECK_EQUAL(v.at("key2"), 2); + BOOST_CHECK_EQUAL(v.at("key3"), 3); + BOOST_CHECK_EQUAL(v.at("key4"), 4); +} + + BOOST_AUTO_TEST_CASE(test_get_toml_local_date) { toml::value v1(toml::local_date{2018, toml::month_t::Apr, 1});