diff options
Diffstat (limited to 'libs/kstd/tests/src/flat_map.cpp')
| -rw-r--r-- | libs/kstd/tests/src/flat_map.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libs/kstd/tests/src/flat_map.cpp b/libs/kstd/tests/src/flat_map.cpp index cde136a..eb599af 100644 --- a/libs/kstd/tests/src/flat_map.cpp +++ b/libs/kstd/tests/src/flat_map.cpp @@ -4,6 +4,8 @@ #include <catch2/catch_test_macros.hpp> #include <functional> +#include <type_traits> +#include <utility> SCENARIO("Flat Map initialization and construction", "[flat_map]") { @@ -159,6 +161,29 @@ SCENARIO("Flat Map iterators", "[flat_map]") ++it; REQUIRE(it == map.cend()); } + + THEN("assignment through the proxy modifies the mapped value") + { + auto it = map.begin(); + + *it = std::pair{1, 100}; + + REQUIRE(it->second == 100); + REQUIRE(map.at(1) == 100); + } + + THEN("structured bindings evaluate correctly") + { + auto it = map.cbegin(); + + auto [key, value] = *it; + + REQUIRE(key == 1); + REQUIRE(value == 10); + + STATIC_REQUIRE(std::is_same_v<decltype(key), int const &>); + STATIC_REQUIRE(std::is_same_v<decltype(value), int const &>); + } } WHEN("using reverse iterators") |
