diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-04 00:16:38 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2025-01-04 00:16:38 +0100 |
commit | db9ebd00f1fb0587d8a2b3a792488c9752f35251 (patch) | |
tree | ddce7f0357d2caf6594074fdaaf0cfee2cf4da0e /src | |
parent | Add test (diff) | |
download | c-hashtable-db9ebd00f1fb0587d8a2b3a792488c9752f35251.tar.gz c-hashtable-db9ebd00f1fb0587d8a2b3a792488c9752f35251.tar.bz2 c-hashtable-db9ebd00f1fb0587d8a2b3a792488c9752f35251.zip |
another test
Diffstat (limited to 'src')
-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); +} |