diff --git a/zig-ecs/src/ecs/groups.zig b/zig-ecs/src/ecs/groups.zig index 25e42c3..2384c3b 100644 --- a/zig-ecs/src/ecs/groups.zig +++ b/zig-ecs/src/ecs/groups.zig @@ -96,3 +96,26 @@ test "BasicGroup creation" { reg.remove(i32, e0); std.debug.assert(group.len() == 0); } + +test "BasicGroup exclides" { + var reg = Registry.init(std.testing.allocator); + defer reg.deinit(); + + var group = reg.group(.{}, .{ i32 }, .{ u32 }); + std.testing.expectEqual(group.len(), 0); + + var e0 = reg.create(); + reg.add(e0, @as(i32, 44)); + + std.debug.assert(group.len() == 1); + + var iterated_entities: usize = 0; + var iter = group.iterator(); + while (iter.next()) |entity| { + iterated_entities += 1; + } + std.testing.expectEqual(iterated_entities, 1); + + reg.add(e0, @as(u32, 55)); + std.debug.assert(group.len() == 0); +} \ No newline at end of file