diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-06-02 13:43:49 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-06-02 16:30:20 +0200 |
| commit | 772861fc5fae1c126fcc63a8809b0a9c729bd152 (patch) | |
| tree | 34560fabed4b1deff4a737872d84ca65aded107e /libs/kstd | |
| parent | b34db5a8acd0639fde9a81b38e96776f7c2ef61e (diff) | |
| download | kernel-772861fc5fae1c126fcc63a8809b0a9c729bd152.tar.xz kernel-772861fc5fae1c126fcc63a8809b0a9c729bd152.zip | |
kernel/vfs: add type registry tests
Diffstat (limited to 'libs/kstd')
| -rw-r--r-- | libs/kstd/kstd/flat_map | 16 | ||||
| -rw-r--r-- | libs/kstd/kstd/flat_map.test.cpp | 10 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libs/kstd/kstd/flat_map b/libs/kstd/kstd/flat_map index f12b1b5..943e9fc 100644 --- a/libs/kstd/kstd/flat_map +++ b/libs/kstd/kstd/flat_map @@ -356,6 +356,22 @@ namespace kstd return find(key) != cend(); } + //! Get a reference to the keys container. + //! + //! @return a reference to the keys container. + [[nodiscard]] constexpr auto keys() const noexcept -> key_container_type const & + { + return m_containers.keys; + } + + //! Get a reference to the values container. + //! + //! @return a reference to the values container. + [[nodiscard]] constexpr auto values() const noexcept -> mapped_container_type const & + { + return m_containers.values; + } + private: containers m_containers; key_compare m_comparator; diff --git a/libs/kstd/kstd/flat_map.test.cpp b/libs/kstd/kstd/flat_map.test.cpp index 2e5a47c..6c57173 100644 --- a/libs/kstd/kstd/flat_map.test.cpp +++ b/libs/kstd/kstd/flat_map.test.cpp @@ -20,6 +20,16 @@ SCENARIO("Flat Map initialization and construction", "[flat_map]") { REQUIRE_FALSE(map.contains(1)); } + + THEN("the keys container is empty") + { + REQUIRE(map.keys().empty()); + } + + THEN("the values container is empty") + { + REQUIRE(map.values().empty()); + } } } } |
