feat(core): add scalar ops and improve memory handling
Added scalar operator overloads for Vector types, fixed pointer math in Store methods, and improved enumerator and memory management. Updated test setup and removed allocation leak tests. - Added left-hand scalar operator overloads for Vector2/3/4. - Fixed pointer arithmetic in Store and GetUnsafePtr methods. - Marked SetValue as readonly in UnsafeSparseSet. - Improved enumerator initialization/reset for slot map and sparse set. - Updated test projects' AssemblyVersion. - Removed TestAllocationManager and added global AllocationManager setup/teardown. - Updated TestConcurrentSlotMap for thread safety and correct cancellation. - Minor formatting and parameter improvements.
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
using Misaki.HighPerformance.LowLevel;
|
||||
using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
|
||||
namespace Misaki.HighPerformance.Test.UnitTest.Buffer;
|
||||
|
||||
[TestClass]
|
||||
public class TestAllocationManager
|
||||
{
|
||||
[TestMethod]
|
||||
public void ShouldNotLeakTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
var array = new UnsafeArray<int>(10, Allocator.Persistent);
|
||||
var array2 = new UnsafeArray<int>(10, Allocator.Persistent);
|
||||
|
||||
array.Dispose();
|
||||
array2.Dispose();
|
||||
|
||||
AllocationManager.Dispose();
|
||||
}
|
||||
finally
|
||||
{
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
var leaks = AllocationManager.LiveAllocationCount;
|
||||
Assert.AreEqual(0, leaks);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldLeakTest()
|
||||
{
|
||||
var array = new UnsafeArray<int>(10, Allocator.Persistent);
|
||||
var array2 = new UnsafeArray<int>(10, Allocator.Persistent);
|
||||
|
||||
try
|
||||
{
|
||||
AllocationManager.Dispose();
|
||||
}
|
||||
catch (MemoryLeakException)
|
||||
{
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
var leaks = AllocationManager.LiveAllocationCount;
|
||||
Assert.AreEqual(2, leaks);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
array.Dispose();
|
||||
array2.Dispose();
|
||||
}
|
||||
|
||||
#if ENABLE_SAFETY_CHECKS
|
||||
Assert.Fail("Expected MemoryLeakException was not thrown.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user