From db9ebd00f1fb0587d8a2b3a792488c9752f35251 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 4 Jan 2025 00:16:38 +0100 Subject: another test --- src/main.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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); +} -- cgit 1.4.1