From bd6f8d99c57004716333a3371fc6574fee534ecc Mon Sep 17 00:00:00 2001 From: scurest Date: Sun, 5 Nov 2017 11:27:56 -0600 Subject: [PATCH] add test for c_allocator --- std/heap.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/std/heap.zig b/std/heap.zig index b654f28a7..3f67a9792 100644 --- a/std/heap.zig +++ b/std/heap.zig @@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct { } }; +test "c_allocator" { + if (builtin.link_libc) { + var slice = c_allocator.alloc(u8, 50) %% return; + defer c_allocator.free(slice); + slice = c_allocator.realloc(u8, slice, 100) %% return; + } +} + test "IncrementingAllocator" { const total_bytes = 100 * 1024 * 1024; var inc_allocator = %%IncrementingAllocator.init(total_bytes);