summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-04 12:15:02 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-04 12:15:02 +0100
commitfd0cc0b063d02a56b6791f6185bb9c2180b28d47 (patch)
tree740ce11e32312ee96925b122072b93b2b816dc32
parentstart fuzzing (diff)
downloadc-hashtable-fd0cc0b063d02a56b6791f6185bb9c2180b28d47.tar.gz
c-hashtable-fd0cc0b063d02a56b6791f6185bb9c2180b28d47.tar.bz2
c-hashtable-fd0cc0b063d02a56b6791f6185bb9c2180b28d47.zip
variable ht capacity in fuzzing
-rw-r--r--src/main.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index 45bdf24..5d74277 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -46,10 +46,10 @@ test "fuzzing" {
     try std.testing.fuzz(struct {
         pub fn func(source: []const u8) !void {
             if (source.len == 0) return;
-            std.debug.print("source: {s}", .{source});
-            var ht = hashtable.hashtable_init(8);
+            const capacity: u8 = if (source[0] == 0) 1 else source[0];
+            var ht = hashtable.hashtable_init(capacity);
             defer _ = hashtable.hashtable_deinit(&ht);
-            var i: usize = 0;
+            var i: usize = 1;
             while (i + 2 < source.len) : (i += 2) {
                 const data: i32 = 4;
                 const operation: u8 = source[i];