diff options
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 40dc44e..a49db18 100644 --- a/src/main.zig +++ b/src/main.zig @@ -31,3 +31,13 @@ test "simple test" { const res: *align(1) i32 = @ptrCast(hashtable.hashtable_get(ht, @constCast("key"))); try std.testing.expectEqual(@as(i32, 4), res.*); } + +test "removing element" { + var ht = hashtable.hashtable_init(); + defer _ = hashtable.hashtable_deinit(&ht); + const data: i32 = 4; + _ = hashtable.hashtable_put(ht, @constCast("key"), @constCast(&data)); + _ = hashtable.hashtable_remove(ht, @constCast("key")); + const res: ?*anyopaque = hashtable.hashtable_get(ht, @constCast("key")); + try std.testing.expectEqual(null, res); +} |