aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-12 17:36:00 +0100
committerDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-12 17:36:00 +0100
commit2d1d7bd16100eb9d702ef67897b2f62a972d6426 (patch)
tree249a995c033e17b87c8a633867e2e5de531c9633 /tests
parent9acd91d41469ed4024e3a8aa85ef1fb2eec909bd (diff)
downloadunja-2d1d7bd16100eb9d702ef67897b2f62a972d6426.tar.gz
unja-2d1d7bd16100eb9d702ef67897b2f62a972d6426.zip
add hashmap_resolve which handles dot notation
Diffstat (limited to 'tests')
-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
index 68b8d0c..d78f768 100644
--- a/tests/test_hashmap.c
+++ b/tests/test_hashmap.c
@@ -15,4 +15,18 @@ TEST(hashmap) {
hashmap_free(hm);
}
+
+TEST(dot_notation) {
+
+ struct hashmap *user = hashmap_new();
+ hashmap_insert(user, "name", "Danny");
+ struct hashmap *hm = hashmap_new();
+ hashmap_insert(hm, "user", user);
+ char *value = (char *) hashmap_resolve(hm, "user.name");
+ assert(value != NULL, "expected value, got NULL");
+ assert(strcmp(value, "Danny") == 0, "expected %s, got %s", "Danny", value);
+
+ hashmap_free(hm);
+}
+
END_TESTS \ No newline at end of file