From 924a6c5d50f478c13f58db9ff26c009e2cce616b Mon Sep 17 00:00:00 2001 From: Evan <115374841+evanwporter@users.noreply.github.com> Date: Sun, 30 Mar 2025 09:50:30 -0700 Subject: [PATCH] Update test_get.cpp --- tests/test_get.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/test_get.cpp b/tests/test_get.cpp index 3c00d2d..137ce0c 100644 --- a/tests/test_get.cpp +++ b/tests/test_get.cpp @@ -406,6 +406,44 @@ TEST_CASE("testing toml::get") } } +TEST_CASE("testing toml::get") +{ + using value_type = toml::value; + + { + const value_type v(toml::array{1, 2, 3, 4}); + const std::unordered_set uset = toml::get>(v); + + CHECK_EQ(uset.size(), 4u); + CHECK(uset.count(1) == 1); + CHECK(uset.count(2) == 1); + CHECK(uset.count(3) == 1); + CHECK(uset.count(4) == 1); + } + + { + const value_type v(toml::array{"alpha", "beta", "delta"}); + const std::unordered_set uset = toml::get>(v); + + CHECK_EQ(uset.size(), 3u); + CHECK(uset.count("alpha") == 1); + CHECK(uset.count("beta") == 1); + CHECK(uset.count("delta") == 1); + } + + { + value_type v(toml::array{42, 42, 54, 69}); + const std::unordered_set uset = toml::get>(std::move(v)); + + // Set will only have one "42" + CHECK_EQ(uset.size(), 3u); + CHECK(uset.count(42) == 1); + CHECK(uset.count(54) == 1); + CHECK(uset.count(69) == 1); + } +} + + TEST_CASE("testing toml::get") { using value_type = toml::value;