diff --git a/core/tests/reflection/traits/fields.cpp b/core/tests/reflection/traits/fields.cpp index b33c84c574..0290bb5d8c 100644 --- a/core/tests/reflection/traits/fields.cpp +++ b/core/tests/reflection/traits/fields.cpp @@ -43,7 +43,18 @@ TEST_CASE("reflection::FieldsTrait") ObjectType object{}; CHECK(field->name() == "foo"); CHECK(field->type().is()); - CHECK(fields.view(&object).get(*field) == &object.foo); + + auto view = fields.view(&object); + CHECK(view.get(*field) == &object.foo); + CHECK(view.begin() != view.end()); + CHECK(view.begin()->field == field); + CHECK(++view.begin() == view.end()); + + auto constView = fields.view(static_cast(&object)); + CHECK(constView.get(*field) == &object.foo); + CHECK(constView.begin() != constView.end()); + CHECK(constView.begin()->field == field); + CHECK(++constView.begin() == constView.end()); } SUBCASE("two fields") @@ -66,5 +77,19 @@ TEST_CASE("reflection::FieldsTrait") CHECK(barField->name() == "bar"); CHECK(barField->type().is()); CHECK(fields.view(static_cast(&object)).get(*barField) == &object.bar); + + auto view = fields.view(&object); + CHECK(view.get(*fooField) == &object.foo); + CHECK(view.begin() != view.end()); + CHECK(view.begin()->field == fooField); + CHECK((++view.begin())->field == barField); + CHECK(++(++view.begin()) == view.end()); + + auto constView = fields.view(static_cast(&object)); + CHECK(constView.get(*fooField) == &object.foo); + CHECK(constView.begin() != constView.end()); + CHECK(constView.begin()->field == fooField); + CHECK((++constView.begin())->field == barField); + CHECK(++(++constView.begin()) == constView.end()); } }