Skip to content

Commit

Permalink
test: yet another failing test to fix #1032 and avoid regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jul 12, 2023
1 parent 65447cd commit 31a1000
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/entt/entity/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,37 @@ TEST(MultiComponentView, StorageEntityWithExcludedComponent) {
});
}

TEST(MultiComponentView, StorageEntityExcludeOnly) {
entt::registry registry;
auto view = registry.view<entt::entity>(entt::exclude<int>);

const auto entity = registry.create();
const auto other = registry.create();
const auto excluded = registry.create();

registry.emplace<int>(excluded);

registry.destroy(entity, entt::to_version(entity));

ASSERT_EQ(view.size_hint(), 3u);
ASSERT_NE(view.begin(), view.end());

// returns all matching identifiers, both in-use and available ones
ASSERT_EQ(std::distance(view.begin(), view.end()), 2);
ASSERT_EQ(*view.begin(), entity);
ASSERT_EQ(*(++view.begin()), other);

// skips available identifiers automatically, only returns in-use elements
for(auto [entt]: view.each()) {
ASSERT_EQ(entt, other);
}

// skips available identifiers automatically, only returns in-use elements
view.each([other](auto entt) {
ASSERT_EQ(entt, other);
});
}

TEST(View, Pipe) {
entt::registry registry;
const auto entity = registry.create();
Expand Down

0 comments on commit 31a1000

Please sign in to comment.