Added XML documentation comments to the `JobScheduler` class and its methods. Added a new method `GetJobStatus` in the `JobScheduler` class for job status retrieval. Added a new `CollectionHandle` struct for collection management. Added a new test class `TestUnsafeSparseSet` with unit tests for `UnsafeSparseSet`. Changed the `WorkerThread` class to improve job retrieval logic with a new `FindJob` method. Changed the `DynamicArena` class by removing commented-out code to streamline memory management. Removed commented-out code in the `WorkerThread` class for improved readability. Removed the `ArenaAllocator` struct from `AllocationManager` to clean up unused code. Removed the `ParallelWriter` struct from `UnsafeSparseSet`, indicating a shift in handling sparse sets.
46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using Misaki.HighPerformance.LowLevel.Buffer;
|
|
using Misaki.HighPerformance.LowLevel.Collections;
|
|
|
|
namespace Misaki.HighPerformance.Test.UnitTest.Collections;
|
|
|
|
[TestClass]
|
|
public class TestUnsafeSparseSet
|
|
{
|
|
private UnsafeSparseSet<int> _sparseSet;
|
|
|
|
[TestInitialize]
|
|
public void Initialize()
|
|
{
|
|
_sparseSet = new UnsafeSparseSet<int>(16, Allocator.Persistent);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Add()
|
|
{
|
|
var id = _sparseSet.Add(10);
|
|
Assert.IsTrue(_sparseSet.Contains(id));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Remove()
|
|
{
|
|
var id = _sparseSet.Add(20);
|
|
Assert.IsTrue(_sparseSet.Contains(id));
|
|
|
|
_sparseSet.Remove(id);
|
|
Assert.IsFalse(_sparseSet.Contains(id));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void IndexReuse()
|
|
{
|
|
var id = _sparseSet.Add(20);
|
|
Assert.IsTrue(_sparseSet.Contains(id));
|
|
|
|
_sparseSet.Remove(id);
|
|
Assert.IsFalse(_sparseSet.Contains(id));
|
|
|
|
var newId = _sparseSet.Add(30);
|
|
Assert.AreEqual(id, newId);
|
|
}
|
|
} |