authorgravatar for scurest@users.noreply.github.comscurest <scurest@users.noreply.github.com> 2017-11-05 11:27:56-06:00
committergravatar for scurest@users.noreply.github.comscurest <scurest@users.noreply.github.com> 2017-11-05 15:46:10-06:00
logbd6f8d99c57004716333a3371fc6574fee534ecc
tree8d4ce59c9f3d384682ae789d1deb82df50b50043
parent4cc9fe90a8a3c0bce803bf9fffd66477da9e37d0

add test for c_allocator


1 files changed, 8 insertions(+), 0 deletions(-)

std/heap.zig+8
...@@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct {...@@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct {
136 }136 }
137};137};
138138
139test "c_allocator" {
140 if (builtin.link_libc) {
141 var slice = c_allocator.alloc(u8, 50) %% return;
142 defer c_allocator.free(slice);
143 slice = c_allocator.realloc(u8, slice, 100) %% return;
144 }
145}
146
139test "IncrementingAllocator" {147test "IncrementingAllocator" {
140 const total_bytes = 100 * 1024 * 1024;148 const total_bytes = 100 * 1024 * 1024;
141 var inc_allocator = %%IncrementingAllocator.init(total_bytes);149 var inc_allocator = %%IncrementingAllocator.init(total_bytes);