From b947b1bdaf36e3cb969cbfae713a34b25d94a4bf Mon Sep 17 00:00:00 2001 From: Ullrich Praetz Date: Mon, 2 Dec 2024 16:17:40 +0100 Subject: [PATCH] Tests: cover EntityStore.EnsureCapacity() --- src/Tests/ECS/Entity/Test_StructHeap.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Tests/ECS/Entity/Test_StructHeap.cs b/src/Tests/ECS/Entity/Test_StructHeap.cs index 1bb350c9..647e60ce 100644 --- a/src/Tests/ECS/Entity/Test_StructHeap.cs +++ b/src/Tests/ECS/Entity/Test_StructHeap.cs @@ -79,6 +79,11 @@ public static void Test_StructHeap_EntityStore_EnsureCapacity() store.CreateEntity(); } Mem.AreEqual(0, store.EnsureCapacity(0)); + + // Coverage: no more free EntityNode's left. EnsureCapacity() will reallocate + var capacity = store.Capacity; + Mem.AreEqual(10, store.EnsureCapacity(10)); + Mem.AreEqual(10 + capacity, store.Capacity); } [Test] @@ -152,6 +157,7 @@ public static void Test_StructHeap_RecycleIds_Disabled() { var store = new EntityStore { RecycleIds = false }; store.RecycleIds = false; + Assert.IsFalse(store.RecycleIds); var entity1 = store.CreateEntity(); var entity2 = store.CreateEntity(); entity1.DeleteEntity(); @@ -164,6 +170,7 @@ public static void Test_StructHeap_RecycleIds_Disabled() // --- can change RecycleIds state on store store.RecycleIds = true; + Assert.IsTrue(store.RecycleIds); entity4.DeleteEntity(); entity3.DeleteEntity();