diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-09 14:02:16 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-09 14:02:16 +0200 |
commit | 5820093e58bd975d5d0de7be2df6af3a84418fb5 (patch) | |
tree | 205531868276b3369ae46542f39dae437e56d8fe /tests/system/alloc.nim | |
parent | 4b09a897583a38bea144e86b8b99b1347b525280 (diff) | |
parent | 7704cdc90ec187ef22f259f0e0f89ceeb5c13431 (diff) | |
download | Nim-5820093e58bd975d5d0de7be2df6af3a84418fb5.tar.gz |
Merge branch 'devel' of github.com:Araq/Nimrod into devel
Diffstat (limited to 'tests/system/alloc.nim')
-rw-r--r-- | tests/system/alloc.nim | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/system/alloc.nim b/tests/system/alloc.nim index 665b448ac..7abefec2a 100644 --- a/tests/system/alloc.nim +++ b/tests/system/alloc.nim @@ -2,44 +2,51 @@ var x: ptr int x = cast[ptr int](alloc(7)) assert x != nil - -x = alloc(int, 3) +x = cast[ptr int](x.realloc(2)) assert x != nil x.dealloc() -x = alloc0(int, 4) +x = createU(int, 3) +assert x != nil +x.free() + +x = create(int, 4) assert cast[ptr array[4, int]](x)[0] == 0 assert cast[ptr array[4, int]](x)[1] == 0 assert cast[ptr array[4, int]](x)[2] == 0 assert cast[ptr array[4, int]](x)[3] == 0 -x = cast[ptr int](x.realloc(2)) -assert x != nil - -x = x.reallocType(4) +x = x.resize(4) assert x != nil -x.dealloc() +x.free() x = cast[ptr int](allocShared(100)) assert x != nil deallocShared(x) -x = allocShared(int, 3) +x = createSharedU(int, 3) assert x != nil -x.deallocShared() +x.freeShared() -x = allocShared0(int, 3) +x = createShared(int, 3) assert x != nil assert cast[ptr array[3, int]](x)[0] == 0 assert cast[ptr array[3, int]](x)[1] == 0 assert cast[ptr array[3, int]](x)[2] == 0 -x = cast[ptr int](reallocShared(x, 2)) assert x != nil +x = cast[ptr int](x.resizeShared(2)) +assert x != nil +x.freeShared() -x = reallocType(x, 12) +x = create(int, 10) assert x != nil +x = x.resize(12) +assert x != nil +x.dealloc() -x = reallocSharedType(x, 1) +x = createShared(int, 1) +assert x != nil +x = x.resizeShared(1) assert x != nil -x.deallocShared() +x.freeShared() |