aboutsummaryrefslogtreecommitdiff
path: root/tests/test_hashmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_hashmap.c')
-rw-r--r--tests/test_hashmap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_hashmap.c b/tests/test_hashmap.c
new file mode 100644
index 0000000..cf6f7a2
--- /dev/null
+++ b/tests/test_hashmap.c
@@ -0,0 +1,14 @@
+#include "test.h"
+#include "hashmap.h"
+
+int main() {
+ struct hashmap *hm = hashmap_new();
+ assert(hashmap_get(hm, "foo") == NULL, "expected NULL");
+
+ hashmap_insert(hm, "foo", "bar");
+ char *value = hashmap_get(hm, "foo");
+ assert(value != NULL, "expected value, got NULL");
+ assert(strcmp(value, "bar") == 0, "expected %s, got %s", "bar", value);
+
+ hashmap_free(hm);
+} \ No newline at end of file