예제 #1
0
    public void AllocatorTest()
    {
        var h = AllocManager.Alloc(256);

        Assert.True(AllocManager.IsAllocated(h));

        Assert.AreEqual((UIntPtr)256, AllocManager.GetSize(h));

        h = AllocManager.ReAlloc(h, 512);

        Assert.AreEqual((UIntPtr)512, AllocManager.GetSize(h));

        Assert.Throws <Exception>(() =>
        {
            AllocManager.ReAlloc(h, -1);
        });

        AllocManager.Free(h);

        Assert.False(AllocManager.IsAllocated(h));

        Assert.True(AllocManager.ReAlloc(h, -1) == null);
    }
예제 #2
0
 public void setup()
 {
     ptr = AllocManager.Alloc <int>(3);
     ptr.WriteAll(new[] { 1, 2, 3 });
 }