Commit bd6f8d99c5

scurest <scurest@users.noreply.github.com>
2017-11-05 18:27:56
add test for c_allocator
1 parent 4cc9fe9
Changed files (1)
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);