Skip to content

Commit

Permalink
Tests: cover EntityStore.EnsureCapacity()
Browse files Browse the repository at this point in the history
  • Loading branch information
friflo committed Dec 2, 2024
1 parent afe8b82 commit b947b1b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Tests/ECS/Entity/Test_StructHeap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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();
Expand All @@ -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();

Expand Down

0 comments on commit b947b1b

Please sign in to comment.