Refactor ECS core, improve thread safety, add tests
- Switch Scene IDs to ushort, update invalid value logic - Add thread safety to SceneManager and ComponentRegistry - Add GHOST_ZERO_INIT_COMPONENT define for editor configs - Update mesh header counts to use int, not uint - Add Collect methods for archetype/component cleanup - Add With/Without/AsView to ComponentSet for easier use - Refactor World creation/destruction, version handling - Refactor ResourceStreamingContext to use init-only props - Add unit tests for entity queries and world lifecycle - Minor code cleanups and formatting fixes
This commit is contained in:
28
src/Test/Ghost.UnitTest/ECS/WorldTests.cs
Normal file
28
src/Test/Ghost.UnitTest/ECS/WorldTests.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Ghost.Entities;
|
||||
|
||||
namespace Ghost.UnitTest.ECS;
|
||||
|
||||
[TestClass]
|
||||
[DoNotParallelize]
|
||||
public class WorldTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void CreateWorld()
|
||||
{
|
||||
using var world = World.Create();
|
||||
Assert.IsNotNull(world);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddEntityThenClearWorld()
|
||||
{
|
||||
using var world = World.Create();
|
||||
Assert.IsNotNull(world);
|
||||
|
||||
world.EntityManager.CreateEntity();
|
||||
Assert.AreEqual(1, world.EntityManager.EntityCount);
|
||||
|
||||
world.Clear(default);
|
||||
Assert.AreEqual(0, world.EntityManager.EntityCount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user