diff --git a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs index 66ab7f7cd4..b61459e0d3 100644 --- a/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs +++ b/Tests/Kernels/Cosmos.Compiler.Tests.TypeSystem/Kernel.cs @@ -7,6 +7,7 @@ using Cosmos.Core; using Cosmos.Debug.Kernel; using Cosmos.IL2CPU; +using Cosmos.Core.Memory; namespace Cosmos.Compiler.Tests.TypeSystem { @@ -69,9 +70,13 @@ private void TestVTablesImpl() private void TestGarbageCollector() { + int allocated = HeapSmall.GetAllocatedObjectCount(); object a = new object(); - + int nowAllocated = HeapSmall.GetAllocatedObjectCount(); GCImplementation.Free(a); + int afterFree = HeapSmall.GetAllocatedObjectCount(); + Assert.AreEqual(allocated + 1, nowAllocated, "NewObj causes one object to be allocated"); + Assert.AreEqual(allocated, afterFree, "Free causes one object to be freed again"); } protected override void Run()