From 81a27b6905ea9a67ba070648a158a66015a77de0 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sun, 5 Jan 2025 12:27:11 +0100 Subject: also fuzz deletions --- src/main.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.zig b/src/main.zig index 5ad6dd3..3f6bcc8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -60,7 +60,7 @@ test "fuzzing" { const key: [*c]u8 = @constCast(@as([2]u8, .{ source[i + 1], 0 })[0..]); const value: [*c]u8 = @constCast(@as([2]u8, .{ source[i + 2], 0 })[0..]); - switch (operation % 2) { + switch (operation % 3) { 0 => { const ret: ?[*]u8 = @ptrCast(hashtable.hashtable_get(ht, key)); const reference_ret: ?[]const u8 = reference_hashmap.get(key[0..2]); @@ -74,6 +74,10 @@ test "fuzzing" { _ = hashtable.hashtable_put(ht, key, @constCast(value), @sizeOf(u8) * 2); try reference_hashmap.put(key[0..2], @as([*]u8, value)[0..2]); }, + 2 => { + _ = hashtable.hashtable_remove(ht, key); + reference_hashmap.remove(key[0..2]); + }, else => unreachable, } } -- cgit 1.4.1