add test for c_allocator

master
scurest 2017-11-05 11:27:56 -06:00
parent 4cc9fe90a8
commit bd6f8d99c5
1 changed files with 8 additions and 0 deletions

View File

@ -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);