From fda08ca25ab299b62d4c15237e9128239bd347f3 Mon Sep 17 00:00:00 2001 From: Ullrich Praetz Date: Sun, 1 Dec 2024 15:30:15 +0100 Subject: [PATCH] cleanup usage of EntityRelation<>() --- src/Tests/ECS/Relations/Test_Relations_Delete.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Tests/ECS/Relations/Test_Relations_Delete.cs b/src/Tests/ECS/Relations/Test_Relations_Delete.cs index dfcdad06..90582417 100644 --- a/src/Tests/ECS/Relations/Test_Relations_Delete.cs +++ b/src/Tests/ECS/Relations/Test_Relations_Delete.cs @@ -12,7 +12,8 @@ public static class Test_Relations_Delete public static void Test_Relations_Delete_int_relations() { var store = new EntityStore(); - var allEntities = store.EntityRelation().Entities; + var intRelations = store.EntityRelation(); + var allEntities = intRelations.Entities; AreEqual("{ }", allEntities.Debug()); var entity1 = store.CreateEntity(1); @@ -29,7 +30,7 @@ public static void Test_Relations_Delete_int_relations() int count = 0; // --- version: iterate all entity relations in O(N) - store.EntityRelation().For((ref IntRelation relation, Entity entity) => { + intRelations.For((ref IntRelation relation, Entity entity) => { switch (count++) { case 0: AreEqual(1, entity.Id); AreEqual(10, relation.value); break; case 1: AreEqual(1, entity.Id); AreEqual(20, relation.value); break; @@ -39,7 +40,7 @@ public static void Test_Relations_Delete_int_relations() AreEqual(3, count); // --- version: get all entity relations in O(1) - var (entities, relations) = store.EntityRelation().Pairs; + var (entities, relations) = intRelations.Pairs; AreEqual("{ 1, 1, 2 }", entities.Debug()); AreEqual("{ 10, 20, 30 }", relations.Debug()); @@ -54,7 +55,8 @@ public static void Test_Relations_Delete_int_relations() public static void Test_Relations_Delete_Entity_relations() { var store = new EntityStore(); - var sourceNodes = store.EntityRelation().Entities; + var attackRelations = store.EntityRelation(); + var sourceNodes = attackRelations.Entities; AreEqual("{ }", sourceNodes.Debug()); var target10 = store.CreateEntity(10); @@ -76,7 +78,7 @@ public static void Test_Relations_Delete_Entity_relations() int count = 0; // --- version: iterate all entity relations in O(N) - store.EntityRelation().For((ref AttackRelation relation, Entity entity) => { + attackRelations.For((ref AttackRelation relation, Entity entity) => { switch (count++) { case 0: AreEqual(1, entity.Id); AreEqual(10, relation.target.Id); break; case 1: AreEqual(1, entity.Id); AreEqual(11, relation.target.Id); break; @@ -86,7 +88,7 @@ public static void Test_Relations_Delete_Entity_relations() AreEqual(3, count); // --- version: get all entity relations in O(1) - var (entities, relations) = store.EntityRelation().Pairs; + var (entities, relations) = attackRelations.Pairs; AreEqual("{ 1, 1, 2 }", entities.Debug()); AreEqual("{ 10, 11, 12 }", relations.Debug());