more tests

This commit is contained in:
Michele Caini
2018-04-20 14:57:21 +02:00
parent fb9fc952c6
commit f9becda02c
2 changed files with 32 additions and 0 deletions

1
TODO
View File

@@ -7,5 +7,6 @@
* does it worth it to add an optional functor to the member functions of snapshot so as to filter out instances and entities?
* ease the assignment of tags as string (use a template class with a non-type template parameter behind the scene)
* dictionary based dependency class (templates copied over) + prefabs (shared state/copy-on-write)
* are const Registry::view/::persistent/::raw possible?
* "singleton mode" for tags (see #66)
* AOB

View File

@@ -561,6 +561,37 @@ TEST(RawView, Functionalities) {
ASSERT_TRUE(view.empty());
}
TEST(RawView, BeginEnd) {
entt::DefaultRegistry registry;
auto view = registry.raw<int>();
for(auto i = 0; i < 3; ++i) {
registry.assign<int>(registry.create());
}
auto begin = view.begin();
auto end = view.end();
ASSERT_NE(begin, end);
ASSERT_NE(++begin, end);
ASSERT_NE(begin++, end);
ASSERT_EQ(begin+1, end);
ASSERT_NE(begin, end);
ASSERT_EQ((begin += 1), end);
ASSERT_EQ(begin, end);
auto cbegin = view.cbegin();
auto cend = view.cend();
ASSERT_NE(cbegin, cend);
ASSERT_NE(++cbegin, cend);
ASSERT_NE(cbegin++, cend);
ASSERT_EQ(cbegin+1, cend);
ASSERT_NE(cbegin, cend);
ASSERT_EQ((cbegin += 1), cend);
ASSERT_EQ(cbegin, cend);
}
TEST(RawView, Empty) {
entt::DefaultRegistry registry;