aboutsummaryrefslogtreecommitdiff
path: root/tests/test_hashmap.c
blob: cf6f7a2f1e1b256652cde649e44c6ce282266c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
}