|
|
@ -7,17 +7,17 @@ const alloc = std.testing.allocator; |
|
|
|
const expect = @import("../expect.zig"); |
|
|
|
const expect = @import("../expect.zig"); |
|
|
|
const util = @import("../util.zig"); |
|
|
|
const util = @import("../util.zig"); |
|
|
|
|
|
|
|
|
|
|
|
const flecs = @import("../../main.zig"); |
|
|
|
const flecszigble = @import("../../main.zig"); |
|
|
|
const FlecsError = flecs.FlecsError; |
|
|
|
const FlecsError = flecszigble.FlecsError; |
|
|
|
const Path = flecs.Path; |
|
|
|
const Path = flecszigble.Path; |
|
|
|
const c = flecs.c; |
|
|
|
const c = flecszigble.c; |
|
|
|
|
|
|
|
|
|
|
|
const Context = flecs.Context(void); |
|
|
|
const Context = flecszigble.Context(void); |
|
|
|
const Entity = Context.Entity; |
|
|
|
const Entity = Context.Entity; |
|
|
|
const World = Context.World; |
|
|
|
const World = Context.World; |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id" { |
|
|
|
test "Entity_init_id" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -26,20 +26,20 @@ test "Entity_init_id" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_name" { |
|
|
|
test "Entity_init_id_name" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
|
const e = try world.entity(.{ .name = "foo" }, .{}); |
|
|
|
const e = try world.entity(.{ .name = "foo" }, .{}); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_path" { |
|
|
|
test "Entity_init_id_path" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ test "Entity_init_id_path" { |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
@ -56,7 +56,7 @@ test "Entity_init_id_path" { |
|
|
|
test "Entity_init_id_add_1_comp" { |
|
|
|
test "Entity_init_id_add_1_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -70,7 +70,7 @@ test "Entity_init_id_add_2_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ test "Entity_init_id_add_2_comp" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_w_scope" { |
|
|
|
test "Entity_init_id_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ test "Entity_init_id_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_name_w_scope" { |
|
|
|
test "Entity_init_id_name_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -113,13 +113,13 @@ test "Entity_init_id_name_w_scope" { |
|
|
|
try expect.true(e.has(.{ c.EcsChildOf, scope })); |
|
|
|
try expect.true(e.has(.{ c.EcsChildOf, scope })); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_path_w_scope" { |
|
|
|
test "Entity_init_id_path_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -135,13 +135,13 @@ test "Entity_init_id_path_w_scope" { |
|
|
|
|
|
|
|
|
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_fullpath_w_scope" { |
|
|
|
test "Entity_init_id_fullpath_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -151,19 +151,19 @@ test "Entity_init_id_fullpath_w_scope" { |
|
|
|
_ = world.setScope(scope); |
|
|
|
_ = world.setScope(scope); |
|
|
|
try expect.equal(scope, world.scope()); |
|
|
|
try expect.equal(scope, world.scope()); |
|
|
|
|
|
|
|
|
|
|
|
const p = try Path.fromString("::parent.child.grandchild", .{ .root_sep = "::", .sep = "." }, flecs.allocator); |
|
|
|
const p = try Path.fromString("::parent.child.grandchild", .{ .root_sep = "::", .sep = "." }, flecszigble.allocator); |
|
|
|
defer p.deinit(); |
|
|
|
defer p.deinit(); |
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
|
|
|
|
|
|
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_fullpath_w_scope_existing" { |
|
|
|
test "Entity_init_id_fullpath_w_scope_existing" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -173,7 +173,7 @@ test "Entity_init_id_fullpath_w_scope_existing" { |
|
|
|
_ = world.setScope(scope); |
|
|
|
_ = world.setScope(scope); |
|
|
|
try expect.equal(scope, world.scope()); |
|
|
|
try expect.equal(scope, world.scope()); |
|
|
|
|
|
|
|
|
|
|
|
const p = try Path.fromString("::parent.child.grandchild", .{ .root_sep = "::", .sep = "." }, flecs.allocator); |
|
|
|
const p = try Path.fromString("::parent.child.grandchild", .{ .root_sep = "::", .sep = "." }, flecszigble.allocator); |
|
|
|
defer p.deinit(); |
|
|
|
defer p.deinit(); |
|
|
|
|
|
|
|
|
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
@ -182,7 +182,7 @@ test "Entity_init_id_fullpath_w_scope_existing" { |
|
|
|
|
|
|
|
|
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
@ -190,7 +190,7 @@ test "Entity_init_id_fullpath_w_scope_existing" { |
|
|
|
test "Entity_init_id_name_1_comp" { |
|
|
|
test "Entity_init_id_name_1_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -200,7 +200,7 @@ test "Entity_init_id_name_1_comp" { |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
@ -209,7 +209,7 @@ test "Entity_init_id_name_2_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -220,7 +220,7 @@ test "Entity_init_id_name_2_comp" { |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
try expect.equal("foo", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
try expect.fmt("foo", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
@ -229,7 +229,7 @@ test "Entity_init_id_name_2_comp_w_scope" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -246,7 +246,7 @@ test "Entity_init_id_name_2_comp_w_scope" { |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.true(e.has(TagA)); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
@ -254,7 +254,7 @@ test "Entity_init_id_name_2_comp_w_scope" { |
|
|
|
test "Entity_id_add_1_comp" { |
|
|
|
test "Entity_id_add_1_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -270,7 +270,7 @@ test "Entity_id_add_2_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -285,22 +285,22 @@ test "Entity_id_add_2_comp" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_id_path_w_sep" { |
|
|
|
test "Entity_init_id_path_w_sep" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
|
const p = try Path.fromString("parent::child", .{ .root_sep = null, .sep = "::" }, flecs.allocator); |
|
|
|
const p = try Path.fromString("parent::child", .{ .root_sep = null, .sep = "::" }, flecszigble.allocator); |
|
|
|
defer p.deinit(); |
|
|
|
defer p.deinit(); |
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
|
const e = try world.entity(.{ .path = p }, .{}); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name" { |
|
|
|
test "Entity_find_id_name" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -312,7 +312,7 @@ test "Entity_find_id_name" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_w_existing_id_name" { |
|
|
|
test "Entity_find_w_existing_id_name" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -327,7 +327,7 @@ test "Entity_find_w_existing_id_name" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name_w_scope" { |
|
|
|
test "Entity_find_id_name_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -340,7 +340,7 @@ test "Entity_find_id_name_w_scope" { |
|
|
|
const e = try world.entity(.{ .name = "child" }, .{}); |
|
|
|
const e = try world.entity(.{ .name = "child" }, .{}); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
|
|
|
|
|
|
|
@ -349,7 +349,7 @@ test "Entity_find_id_name_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path" { |
|
|
|
test "Entity_find_id_path" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -358,7 +358,7 @@ test "Entity_find_id_path" { |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
|
|
|
|
|
|
|
@ -367,7 +367,7 @@ test "Entity_find_id_path" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path_w_scope" { |
|
|
|
test "Entity_find_id_path_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -382,7 +382,7 @@ test "Entity_find_id_path_w_scope" { |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
const e = try world.entity(.{ .path = e_path }, .{}); |
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
try expect.equal("grandchild", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child.grandchild", "{}", .{path}); |
|
|
|
|
|
|
|
|
|
|
@ -391,7 +391,7 @@ test "Entity_find_id_path_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name_match" { |
|
|
|
test "Entity_find_id_name_match" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -403,7 +403,7 @@ test "Entity_find_id_name_match" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name_match_w_scope" { |
|
|
|
test "Entity_find_id_name_match_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -416,7 +416,7 @@ test "Entity_find_id_name_match_w_scope" { |
|
|
|
const e = try world.entity(.{ .name = "child" }, .{}); |
|
|
|
const e = try world.entity(.{ .name = "child" }, .{}); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
try expect.equal("child", e.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try e.path(flecs.allocator); |
|
|
|
const path = try e.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
try expect.fmt("parent.child", "{}", .{path}); |
|
|
|
|
|
|
|
|
|
|
@ -432,7 +432,7 @@ test "Entity_find_id_name_match_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path_match" { |
|
|
|
test "Entity_find_id_path_match" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -446,7 +446,7 @@ test "Entity_find_id_path_match" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path_match_w_scope" { |
|
|
|
test "Entity_find_id_path_match_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -473,7 +473,7 @@ test "Entity_find_id_path_match_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name_mismatch" { |
|
|
|
test "Entity_find_id_name_mismatch" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -490,7 +490,7 @@ test "Entity_find_id_name_mismatch" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_name_mismatch_w_scope" { |
|
|
|
test "Entity_find_id_name_mismatch_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -511,7 +511,7 @@ test "Entity_find_id_name_mismatch_w_scope" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path_mismatch" { |
|
|
|
test "Entity_find_id_path_mismatch" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -530,7 +530,7 @@ test "Entity_find_id_path_mismatch" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_find_id_path_mismatch_w_scope" { |
|
|
|
test "Entity_find_id_path_mismatch_w_scope" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -559,7 +559,7 @@ test "Entity_find_id_path_mismatch_w_scope" { |
|
|
|
test "Entity_find_id_add_1_comp" { |
|
|
|
test "Entity_find_id_add_1_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -577,7 +577,7 @@ test "Entity_find_id_add_2_comp" { |
|
|
|
const TagA = struct {}; |
|
|
|
const TagA = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
const TagB = struct {}; |
|
|
|
|
|
|
|
|
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -594,7 +594,7 @@ test "Entity_find_id_add_2_comp" { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_w_scope_name" { |
|
|
|
test "Entity_init_w_scope_name" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
@ -609,13 +609,13 @@ test "Entity_init_w_scope_name" { |
|
|
|
const child = try world.entity(.{ .name = "foo" }, .{}); |
|
|
|
const child = try world.entity(.{ .name = "foo" }, .{}); |
|
|
|
try expect.equal("foo", child.name()); |
|
|
|
try expect.equal("foo", child.name()); |
|
|
|
|
|
|
|
|
|
|
|
const path = try child.path(flecs.allocator); |
|
|
|
const path = try child.path(flecszigble.allocator); |
|
|
|
defer path.deinit(); |
|
|
|
defer path.deinit(); |
|
|
|
try expect.fmt("parent.foo.foo", "{}", .{path}); |
|
|
|
try expect.fmt("parent.foo.foo", "{}", .{path}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test "Entity_init_w_core_name" { |
|
|
|
test "Entity_init_w_core_name" { |
|
|
|
flecs.init(alloc); |
|
|
|
flecszigble.init(alloc); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
var world = try World.initMinimal(); |
|
|
|
defer world.deinit(); |
|
|
|
defer world.deinit(); |
|
|
|
|
|
|
|
|
|
|
|