diff --git a/include/gridtools/common/hymap.hpp b/include/gridtools/common/hymap.hpp index f410874d9..6ea750a18 100644 --- a/include/gridtools/common/hymap.hpp +++ b/include/gridtools/common/hymap.hpp @@ -256,6 +256,7 @@ namespace gridtools { template <> struct keys<>::values<> { friend values tuple_getter(values const &) { return {}; } + friend keys hymap_get_keys(values const &) { return {}; } }; template diff --git a/tests/unit_tests/common/test_hymap.cpp b/tests/unit_tests/common/test_hymap.cpp index 0775dcc05..f117e169b 100644 --- a/tests/unit_tests/common/test_hymap.cpp +++ b/tests/unit_tests/common/test_hymap.cpp @@ -15,6 +15,7 @@ #include +#include #include #include @@ -32,6 +33,13 @@ namespace gridtools { static_assert(is_hymap::values>::value); static_assert(is_hymap::values>::value); + static_assert(std::is_same_v>, + meta::list, integral_constant>>); + static_assert(std::is_same_v>, + meta::list, integral_constant>>); + static_assert(std::is_same_v::values<>>, hymap::keys<>>); + static_assert(std::is_same_v::values>, hymap::keys>); + TEST(tuple_like, smoke) { using testee_t = hymap::keys::values; @@ -188,7 +196,25 @@ namespace gridtools { EXPECT_EQ(16, at_key(testee)); } - TEST(assingment, smoke) { + TEST(concat, smoke) { + auto m1 = hymap::keys::make_values(1, 2); + auto m2 = hymap::keys::make_values(3.5); + auto testee = hymap::concat(m1, m2); + + EXPECT_EQ(1, at_key(testee)); + EXPECT_EQ(2, at_key(testee)); + EXPECT_EQ(3.5, at_key(testee)); + } + + TEST(concat, empty) { + auto m1 = hymap::keys<>::make_values(); + auto m2 = hymap::keys::make_values(42); + auto testee = hymap::concat(m1, m2); + + EXPECT_EQ(42, at_key(testee)); + } + + TEST(assignment, smoke) { hymap::keys::values testee; auto src = hymap::keys::make_values(88, 3.5, 16); testee = src;