aboutsummaryrefslogtreecommitdiff
path: root/lib/std/sort.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-14 10:27:44 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-14 10:27:44 -0500
commita8b36fbe34e4acfea1fcb348fbed321b05611fd3 (patch)
tree23f489f85c427a003577f5c40b74201ba8c85ddb /lib/std/sort.zig
parentcdc5070f216a924d24588b8d0fe06400e036e6bf (diff)
parent40b9db7cad6f876bb3e8fa32d7b32bbd4bc983ea (diff)
downloadzig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.tar.gz
zig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.zip
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'lib/std/sort.zig')
-rw-r--r--lib/std/sort.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/sort.zig b/lib/std/sort.zig
index df9702b325..938c5e98f1 100644
--- a/lib/std/sort.zig
+++ b/lib/std/sort.zig
@@ -1220,16 +1220,16 @@ test "sort fuzz testing" {
const test_case_count = 10;
var i: usize = 0;
while (i < test_case_count) : (i += 1) {
- fuzzTest(&prng.random);
+ try fuzzTest(&prng.random);
}
}
var fixed_buffer_mem: [100 * 1024]u8 = undefined;
-fn fuzzTest(rng: *std.rand.Random) void {
+fn fuzzTest(rng: *std.rand.Random) !void {
const array_size = rng.range(usize, 0, 1000);
- var fixed_allocator = std.heap.FixedBufferAllocator.init(fixed_buffer_mem[0..]);
- var array = fixed_allocator.allocator.alloc(IdAndValue, array_size) catch unreachable;
+ var array = try testing.allocator.alloc(IdAndValue, array_size);
+ defer testing.allocator.free(array);
// populate with random data
for (array) |*item, index| {
item.id = index;