aboutsummaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-31 18:01:27 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-31 18:01:27 +0000
commitd934607069c77d6cf4caf9061e43d6d20c5aa111 (patch)
treebe3079405369d40605dacfea5dce0a0bf6fddf26 /src/or/test.c
parent3843b1b3d09ca9d6546bfcf8e5f3bc10de4c2748 (diff)
downloadtor-d934607069c77d6cf4caf9061e43d6d20c5aa111.tar.gz
tor-d934607069c77d6cf4caf9061e43d6d20c5aa111.zip
r6979@Kushana: nickm | 2006-07-31 13:16:58 -0400
Add assert_ok functions for strmap and digestmap; use them in unit test code. svn:r6958
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 4a258afb71..fa342d629a 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -1105,8 +1105,10 @@ test_strmap(void)
test_eq_ptr(strmap_get(map,"K1"), (void*)100);
test_eq_ptr(strmap_get(map,"K2"), (void*)101);
test_eq_ptr(strmap_get(map,"K-not-there"), NULL);
+ strmap_assert_ok(map);
v = strmap_remove(map,"K2");
+ strmap_assert_ok(map);
test_eq_ptr(v, (void*)101);
test_eq_ptr(strmap_get(map,"K2"), NULL);
test_eq_ptr(strmap_remove(map,"K2"), NULL);
@@ -1114,8 +1116,10 @@ test_strmap(void)
strmap_set(map, "K2", (void*)101);
strmap_set(map, "K3", (void*)102);
strmap_set(map, "K4", (void*)103);
+ strmap_assert_ok(map);
strmap_set(map, "K5", (void*)104);
strmap_set(map, "K6", (void*)105);
+ strmap_assert_ok(map);
#if 0
iter = strmap_iter_init(map);
@@ -1142,6 +1146,7 @@ test_strmap(void)
test_eq_ptr(strmap_get(map, "K5"), (void*)10816);
#endif
+ strmap_assert_ok(map);
/* Clean up after ourselves. */
strmap_free(map, NULL);
@@ -1149,9 +1154,11 @@ test_strmap(void)
map = strmap_new();
strmap_set_lc(map,"Ab.C", (void*)1);
test_eq_ptr(strmap_get(map,"ab.c"), (void*)1);
+ strmap_assert_ok(map);
test_eq_ptr(strmap_get_lc(map,"AB.C"), (void*)1);
test_eq_ptr(strmap_get(map,"AB.C"), NULL);
test_eq_ptr(strmap_remove_lc(map,"aB.C"), (void*)1);
+ strmap_assert_ok(map);
test_eq_ptr(strmap_get_lc(map,"AB.C"), NULL);
strmap_free(map,NULL);
}