diff options
| author | scurest <scurest@users.noreply.github.com> | 2017-11-05 11:27:56 -0600 |
|---|---|---|
| committer | scurest <scurest@users.noreply.github.com> | 2017-11-05 15:46:10 -0600 |
| commit | bd6f8d99c57004716333a3371fc6574fee534ecc (patch) | |
| tree | 8d4ce59c9f3d384682ae789d1deb82df50b50043 | |
| parent | 4cc9fe90a8a3c0bce803bf9fffd66477da9e37d0 (diff) | |
| download | zig-bd6f8d99c57004716333a3371fc6574fee534ecc.tar.gz zig-bd6f8d99c57004716333a3371fc6574fee534ecc.zip | |
add test for c_allocator
| -rw-r--r-- | std/heap.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/std/heap.zig b/std/heap.zig index b654f28a74..3f67a97926 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); |
