From c946cf6a89bbeae7fb96a67b55d91b7ae0cfa48d Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 30 Mar 2026 12:41:14 +0000 Subject: kstd/flat_map: fix iterator reference --- libs/kstd/tests/src/flat_map.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'libs/kstd/tests/src') 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 #include +#include +#include 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); + STATIC_REQUIRE(std::is_same_v); + } } WHEN("using reverse iterators") -- cgit v1.2.3