Skip to content

Commit

Permalink
test: add test for triangulator data dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
andywiecko committed Sep 15, 2024
1 parent cd02a15 commit 03d7713
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/TriangulatorEditorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,16 @@ public void AsNativeArrayInJobTest()
Assert.That(a, Is.EqualTo(new[] { 2, 3, 4, 5, 6, 7 }));
handle.Free();
}

[Test, Description("Checks for memory leaks during Triangulator allocation and disposal.")]
public void DisposeLeaksTest()
{
// Log and forgive any existing leaks before the test.
// Note: These leaks may not be related to Triangulator and could be caused by other internal systems (e.g., UIElements).
Unity.Collections.LowLevel.Unsafe.UnsafeUtility.CheckForLeaks();
new Triangulator(Allocator.Persistent).Dispose();
var leaks = Unity.Collections.LowLevel.Unsafe.UnsafeUtility.CheckForLeaks();
Assert.That(leaks, Is.Zero);
}
}
}

0 comments on commit 03d7713

Please sign in to comment.