aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-10-28 18:32:55 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-10-29 06:20:52 -0700
commit1c0a8b8fe4a979b0ba9e6cd790c33a6dc12f0f05 (patch)
treed9368c6092293e78d7e03083b8ea44a71dbea4f5 /lib/std
parenta45cafb7f0d182be9d2652229583297e55eac5c1 (diff)
downloadzig-1c0a8b8fe4a979b0ba9e6cd790c33a6dc12f0f05.tar.gz
zig-1c0a8b8fe4a979b0ba9e6cd790c33a6dc12f0f05.zip
std.hash_map: tune slow unit tests
These are the only two unit tests that take longer than 1s on my computer.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/hash_map.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig
index 85424fe45e..83d4b5fae3 100644
--- a/lib/std/hash_map.zig
+++ b/lib/std/hash_map.zig
@@ -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);