From a021941a27821f4de7e34084b11f13250151f93f Mon Sep 17 00:00:00 2001 From: Ricardo Antunes Date: Tue, 26 Sep 2023 15:08:14 +0100 Subject: [PATCH] test(core): cover std::unordered_map reflection --- core/tests/CMakeLists.txt | 1 + .../reflection/external/unordered_map.cpp | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 core/tests/reflection/external/unordered_map.cpp diff --git a/core/tests/CMakeLists.txt b/core/tests/CMakeLists.txt index c700c695c2..503d5b8432 100644 --- a/core/tests/CMakeLists.txt +++ b/core/tests/CMakeLists.txt @@ -12,6 +12,7 @@ add_executable( reflection/traits/constructible.cpp reflection/external/primitives.cpp reflection/external/map.cpp + reflection/external/unordered_map.cpp data/fs/embedded_archive.cpp data/fs/standard_archive.cpp diff --git a/core/tests/reflection/external/unordered_map.cpp b/core/tests/reflection/external/unordered_map.cpp new file mode 100644 index 0000000000..8b722aea5d --- /dev/null +++ b/core/tests/reflection/external/unordered_map.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include + +#include "../traits/constructible.hpp" +#include "../traits/dictionary.hpp" + +template +static void test(const char* name, std::unordered_map map, K insertedKey, V insertedValue) +{ + CHECK(reflect>().name() == name); + testDictionary, K, V>(map, map.size(), &insertedKey, &insertedValue); + testConstructible>(&map); +} + +TEST_CASE("reflection::reflect>()") +{ + test("std::unordered_map", {{1, 2}, {2, 4}}, 3, 6); + test>("std::unordered_map>", + { + {'H', {{'i', true}, {'o', false}}}, + }, + 'A', {{'h', true}}); +}