diff --git a/tests/test_parse_file.cpp b/tests/test_parse_file.cpp index b5c6a8a..0e974b7 100644 --- a/tests/test_parse_file.cpp +++ b/tests/test_parse_file.cpp @@ -14,42 +14,42 @@ BOOST_AUTO_TEST_CASE(test_example) { const auto data = toml::parse("toml/tests/example.toml"); - BOOST_CHECK_EQUAL(toml::get(data.at("title")), "TOML Example"); - toml::Table owner = toml::get(data.at("owner")); + BOOST_CHECK_EQUAL(toml::find(data, "title"), "TOML Example"); + const auto& owner = toml::find(data, "owner"); { - BOOST_CHECK_EQUAL(toml::get(owner.at("name")), "Tom Preston-Werner"); - BOOST_CHECK_EQUAL(toml::get(owner.at("organization")), "GitHub"); - BOOST_CHECK_EQUAL(toml::get(owner.at("bio")), + BOOST_CHECK_EQUAL(toml::find(owner, "name"), "Tom Preston-Werner"); + BOOST_CHECK_EQUAL(toml::find(owner, "organization"), "GitHub"); + BOOST_CHECK_EQUAL(toml::find(owner, "bio"), "GitHub Cofounder & CEO\nLikes tater tots and beer."); - BOOST_CHECK_EQUAL(toml::get(owner.at("dob")), + BOOST_CHECK_EQUAL(toml::find(owner, "dob"), toml::offset_datetime(toml::local_date(1979, toml::month_t::May, 27), toml::local_time(7, 32, 0), toml::time_offset(0, 0))); } - toml::Table database = toml::get(data.at("database")); + const auto& database = toml::find(data, "database"); { - BOOST_CHECK_EQUAL(toml::get(database.at("server")), "192.168.1.1"); + BOOST_CHECK_EQUAL(toml::find(database, "server"), "192.168.1.1"); const std::vector expected_ports{8001, 8001, 8002}; - BOOST_CHECK(toml::get>(database.at("ports")) == expected_ports); - BOOST_CHECK_EQUAL(toml::get(database.at("connection_max")), 5000); - BOOST_CHECK_EQUAL(toml::get(database.at("enabled")), true); + BOOST_CHECK(toml::find>(database, "ports") == expected_ports); + BOOST_CHECK_EQUAL(toml::find(database, "connection_max"), 5000); + BOOST_CHECK_EQUAL(toml::find(database, "enabled"), true); } - toml::Table servers = toml::get(data.at("servers")); + const auto& servers = toml::find(data, "servers"); { - toml::Table alpha = toml::get(servers.at("alpha")); + toml::table alpha = toml::find(servers, "alpha"); BOOST_CHECK_EQUAL(toml::get(alpha.at("ip")), "10.0.0.1"); BOOST_CHECK_EQUAL(toml::get(alpha.at("dc")), "eqdc10"); - toml::Table beta = toml::get(servers.at("beta")); + toml::table beta = toml::find(servers, "beta"); BOOST_CHECK_EQUAL(toml::get(beta.at("ip")), "10.0.0.2"); BOOST_CHECK_EQUAL(toml::get(beta.at("dc")), "eqdc10"); BOOST_CHECK_EQUAL(toml::get(beta.at("country")), "\xE4\xB8\xAD\xE5\x9B\xBD"); } - toml::Table clients = toml::get(data.at("clients")); + const auto& clients = toml::find(data, "clients"); { - toml::Array clients_data = toml::get(clients.at("data")); + toml::array clients_data = toml::find(clients, "data"); std::vector expected_name{"gamma", "delta"}; BOOST_CHECK(toml::get>(clients_data.at(0)) == expected_name); @@ -57,12 +57,12 @@ BOOST_AUTO_TEST_CASE(test_example) BOOST_CHECK(toml::get>(clients_data.at(1)) == expected_number); std::vector expected_hosts{"alpha", "omega"}; - BOOST_CHECK(toml::get>(clients.at("hosts")) == + BOOST_CHECK(toml::find>(clients, "hosts") == expected_hosts); } - std::vector products = - toml::get>(data.at("products")); + std::vector products = + toml::find>(data, "products"); { BOOST_CHECK_EQUAL(toml::get(products.at(0).at("name")), "Hammer"); @@ -83,42 +83,42 @@ BOOST_AUTO_TEST_CASE(test_example_stream) std::ifstream ifs("toml/tests/example.toml"); const auto data = toml::parse(ifs); - BOOST_CHECK_EQUAL(toml::get(data.at("title")), "TOML Example"); - toml::Table owner = toml::get(data.at("owner")); + BOOST_CHECK_EQUAL(toml::find(data, "title"), "TOML Example"); + const auto& owner = toml::find(data, "owner"); { - BOOST_CHECK_EQUAL(toml::get(owner.at("name")), "Tom Preston-Werner"); - BOOST_CHECK_EQUAL(toml::get(owner.at("organization")), "GitHub"); - BOOST_CHECK_EQUAL(toml::get(owner.at("bio")), + BOOST_CHECK_EQUAL(toml::find(owner, "name"), "Tom Preston-Werner"); + BOOST_CHECK_EQUAL(toml::find(owner, "organization"), "GitHub"); + BOOST_CHECK_EQUAL(toml::find(owner, "bio"), "GitHub Cofounder & CEO\nLikes tater tots and beer."); - BOOST_CHECK_EQUAL(toml::get(owner.at("dob")), + BOOST_CHECK_EQUAL(toml::find(owner, "dob"), toml::offset_datetime(toml::local_date(1979, toml::month_t::May, 27), toml::local_time(7, 32, 0), toml::time_offset(0, 0))); } - toml::Table database = toml::get(data.at("database")); + const auto& database = toml::find(data, "database"); { - BOOST_CHECK_EQUAL(toml::get(database.at("server")), "192.168.1.1"); + BOOST_CHECK_EQUAL(toml::find(database, "server"), "192.168.1.1"); const std::vector expected_ports{8001, 8001, 8002}; - BOOST_CHECK(toml::get>(database.at("ports")) == expected_ports); - BOOST_CHECK_EQUAL(toml::get(database.at("connection_max")), 5000); - BOOST_CHECK_EQUAL(toml::get(database.at("enabled")), true); + BOOST_CHECK(toml::find>(database, "ports") == expected_ports); + BOOST_CHECK_EQUAL(toml::find(database, "connection_max"), 5000); + BOOST_CHECK_EQUAL(toml::find(database, "enabled"), true); } - toml::Table servers = toml::get(data.at("servers")); + const auto& servers = toml::find(data, "servers"); { - toml::Table alpha = toml::get(servers.at("alpha")); + toml::table alpha = toml::find(servers, "alpha"); BOOST_CHECK_EQUAL(toml::get(alpha.at("ip")), "10.0.0.1"); BOOST_CHECK_EQUAL(toml::get(alpha.at("dc")), "eqdc10"); - toml::Table beta = toml::get(servers.at("beta")); + toml::table beta = toml::find(servers, "beta"); BOOST_CHECK_EQUAL(toml::get(beta.at("ip")), "10.0.0.2"); BOOST_CHECK_EQUAL(toml::get(beta.at("dc")), "eqdc10"); BOOST_CHECK_EQUAL(toml::get(beta.at("country")), "\xE4\xB8\xAD\xE5\x9B\xBD"); } - toml::Table clients = toml::get(data.at("clients")); + const auto& clients = toml::find(data, "clients"); { - toml::Array clients_data = toml::get(clients.at("data")); + toml::array clients_data = toml::find(clients, "data"); std::vector expected_name{"gamma", "delta"}; BOOST_CHECK(toml::get>(clients_data.at(0)) == expected_name); @@ -126,12 +126,12 @@ BOOST_AUTO_TEST_CASE(test_example_stream) BOOST_CHECK(toml::get>(clients_data.at(1)) == expected_number); std::vector expected_hosts{"alpha", "omega"}; - BOOST_CHECK(toml::get>(clients.at("hosts")) == + BOOST_CHECK(toml::find>(clients, "hosts") == expected_hosts); } - std::vector products = - toml::get>(data.at("products")); + std::vector products = + toml::find>(data, "products"); { BOOST_CHECK_EQUAL(toml::get(products.at(0).at("name")), "Hammer"); @@ -147,51 +147,49 @@ BOOST_AUTO_TEST_CASE(test_example_stream) } } - BOOST_AUTO_TEST_CASE(test_fruit) { const auto data = toml::parse("toml/tests/fruit.toml"); - const auto blah = toml::get>( - toml::get(data.at("fruit")).at("blah")); - BOOST_CHECK_EQUAL(toml::get(blah.at(0).at("name")), "apple"); - BOOST_CHECK_EQUAL(toml::get(blah.at(1).at("name")), "banana"); + const auto blah = toml::find(toml::find(data, "fruit"), "blah"); + BOOST_CHECK_EQUAL(toml::find(blah.at(0), "name"), "apple"); + BOOST_CHECK_EQUAL(toml::find(blah.at(1), "name"), "banana"); { - const auto physical = toml::get(blah.at(0).at("physical")); - BOOST_CHECK_EQUAL(toml::get(physical.at("color")), "red"); - BOOST_CHECK_EQUAL(toml::get(physical.at("shape")), "round"); + const auto physical = toml::find(blah.at(0), "physical"); + BOOST_CHECK_EQUAL(toml::find(physical, "color"), "red"); + BOOST_CHECK_EQUAL(toml::find(physical, "shape"), "round"); } { - const auto physical = toml::get(blah.at(1).at("physical")); - BOOST_CHECK_EQUAL(toml::get(physical.at("color")), "yellow"); - BOOST_CHECK_EQUAL(toml::get(physical.at("shape")), "bent"); + const auto physical = toml::find(blah.at(1), "physical"); + BOOST_CHECK_EQUAL(toml::find(physical, "color"), "yellow"); + BOOST_CHECK_EQUAL(toml::find(physical, "shape"), "bent"); } } BOOST_AUTO_TEST_CASE(test_hard_example) { const auto data = toml::parse("toml/tests/hard_example.toml"); - const auto the = toml::get(data.at("the")); - BOOST_CHECK_EQUAL(toml::get(the.at("test_string")), + const auto the = toml::find(data, "the"); + BOOST_CHECK_EQUAL(toml::find(the, "test_string"), "You'll hate me after this - #"); - const auto hard = toml::get(the.at("hard")); + const auto hard = toml::find(the, "hard"); const std::vector expected_the_hard_test_array{"] ", " # "}; - BOOST_CHECK(toml::get>(hard.at("test_array")) == + BOOST_CHECK(toml::find>(hard, "test_array") == expected_the_hard_test_array); const std::vector expected_the_hard_test_array2{ "Test #11 ]proved that", "Experiment #9 was a success"}; - BOOST_CHECK(toml::get>(hard.at("test_array2")) == + BOOST_CHECK(toml::find>(hard, "test_array2") == expected_the_hard_test_array2); - BOOST_CHECK_EQUAL(toml::get(hard.at("another_test_string")), + BOOST_CHECK_EQUAL(toml::find(hard, "another_test_string"), " Same thing, but with a string #"); - BOOST_CHECK_EQUAL(toml::get(hard.at("harder_test_string")), + BOOST_CHECK_EQUAL(toml::find(hard, "harder_test_string"), " And when \"'s are in the string, along with # \""); - const auto bit = toml::get(hard.at("bit#")); - BOOST_CHECK_EQUAL(toml::get(bit.at("what?")), + const auto bit = toml::find(hard, "bit#"); + BOOST_CHECK_EQUAL(toml::find(bit, "what?"), "You don't think some user won't do that?"); const std::vector expected_multi_line_array{"]"}; - BOOST_CHECK(toml::get>(bit.at("multi_line_array")) == + BOOST_CHECK(toml::find>(bit, "multi_line_array") == expected_multi_line_array); } @@ -210,8 +208,8 @@ BOOST_AUTO_TEST_CASE(test_file_with_BOM) std::istringstream iss(table); const auto data = toml::parse(iss, "test_file_with_BOM.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -226,8 +224,8 @@ BOOST_AUTO_TEST_CASE(test_file_with_BOM) } const auto data = toml::parse("tmp.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -239,8 +237,8 @@ BOOST_AUTO_TEST_CASE(test_file_with_BOM) std::istringstream iss(table); const auto data = toml::parse(iss, "test_file_with_BOM_CRLF.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -258,8 +256,8 @@ BOOST_AUTO_TEST_CASE(test_file_with_BOM) } const auto data = toml::parse("tmp.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } } @@ -275,8 +273,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -288,8 +286,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file_CRLF.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { @@ -302,8 +300,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -315,8 +313,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { @@ -329,8 +327,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file_ws.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -342,8 +340,8 @@ BOOST_AUTO_TEST_CASE(test_file_without_newline_at_the_end_of_file) const auto data = toml::parse(iss, "test_file_without_newline_at_the_end_of_file_ws.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } } @@ -362,8 +360,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -377,8 +375,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } // comment w/ newline @@ -394,8 +392,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -409,8 +407,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } // CRLF version @@ -426,8 +424,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -441,8 +439,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -455,8 +453,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -470,8 +468,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_comment) const auto data = toml::parse(iss, "test_files_end_with_comment.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } } @@ -489,8 +487,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -504,8 +502,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } // with whitespaces @@ -521,8 +519,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -536,8 +534,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -551,8 +549,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -566,8 +564,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } // with whitespaces but no newline @@ -582,8 +580,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } @@ -600,8 +598,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -615,8 +613,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } // with whitespaces @@ -632,8 +630,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -647,8 +645,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -662,8 +660,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -677,8 +675,8 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } { const std::string table( @@ -691,7 +689,7 @@ BOOST_AUTO_TEST_CASE(test_files_end_with_empty_lines) const auto data = toml::parse(iss, "test_files_end_with_newline.toml"); - BOOST_CHECK_EQUAL(toml::get (data.at("key")), "value"); - BOOST_CHECK_EQUAL(toml::find(data.at("table"), "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(data, "key"), "value"); + BOOST_CHECK_EQUAL(toml::find(toml::find(data, "table"), "key"), "value"); } }