mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.hash_map: tune slow unit tests
These are the only two unit tests that take longer than 1s on my computer.
This commit is contained in:
parent
a45cafb7f0
commit
1c0a8b8fe4
@ -1827,9 +1827,9 @@ test "put and remove loop in random order" {
|
||||
}
|
||||
}
|
||||
|
||||
test "remove one million elements in random order" {
|
||||
test "remove many elements in random order" {
|
||||
const Map = AutoHashMap(u32, u32);
|
||||
const n = 1000 * 1000;
|
||||
const n = 1000 * 100;
|
||||
var map = Map.init(std.heap.page_allocator);
|
||||
defer map.deinit();
|
||||
|
||||
@ -2147,14 +2147,14 @@ test "getOrPut allocation failure" {
|
||||
try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello"));
|
||||
}
|
||||
|
||||
test "std.hash_map rehash" {
|
||||
test "rehash" {
|
||||
var map = AutoHashMap(usize, usize).init(std.testing.allocator);
|
||||
defer map.deinit();
|
||||
|
||||
var prng = std.Random.DefaultPrng.init(0);
|
||||
const random = prng.random();
|
||||
|
||||
const count = 6 * random.intRangeLessThan(u32, 100_000, 500_000);
|
||||
const count = 4 * random.intRangeLessThan(u32, 100_000, 500_000);
|
||||
|
||||
for (0..count) |i| {
|
||||
try map.put(i, i);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user