| ... | @@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct { | ... | @@ -136,6 +136,14 @@ pub const IncrementingAllocator = struct { |
| 136 | } | 136 | } |
| 137 | }; | 137 | }; |
| 138 | | 138 | |
| | 139 | test "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 | |
| 139 | test "IncrementingAllocator" { | 147 | test "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); |