summaryrefslogtreecommitdiffhomepage
path: root/test/entity.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-18 15:55:10 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-18 15:55:10 +0100
commit28449ce459900bd88527ed424c4297b4cd936fe6 (patch)
treed13c7ed823655434c5539589e825d45450c04e4f /test/entity.cpp
parent9b8b439132b00f0aa6f0c307fa06641803dd75a8 (diff)
entity/field: add field name to erased accessor
Diffstat (limited to 'test/entity.cpp')
-rw-r--r--test/entity.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/entity.cpp b/test/entity.cpp
index f18b30ca..8e80ba64 100644
--- a/test/entity.cpp
+++ b/test/entity.cpp
@@ -119,6 +119,7 @@ void test_erasure() {
void test_metadata()
{
constexpr auto m = entity_metadata<TestAccessors>();
+ static_assert(sizeof m == 1);
fm_assert(m.class_name == name_of<TestAccessors>);
fm_assert(m.class_name.contains("TestAccessors"_s));
const auto [foo, bar, baz] = m.accessors;
@@ -156,11 +157,28 @@ constexpr bool test_null_writer()
} // namespace
+static constexpr bool test_names()
+{
+ constexpr auto m = entity_metadata<TestAccessors>();
+ auto [foo1, bar1, baz1] = m.accessors;
+ auto [foo2, bar2, baz2] = m.erased_accessors;
+
+ fm_assert(foo1.name == "foo"_s);
+ fm_assert(bar1.name == "bar"_s);
+ fm_assert(baz1.name == "baz"_s);
+
+ fm_assert(foo2.field_name == "foo"_s);
+ fm_assert(bar2.field_name == "bar"_s);
+ fm_assert(baz2.field_name == "baz"_s);
+ return true;
+}
+
void test_app::test_entity()
{
static_assert(test_accessors());
static_assert(test_visitor());
static_assert(test_null_writer());
+ static_assert(test_names());
test_fun2();
test_erasure();
test_type_name();