aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_containers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-02 14:32:05 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-02 14:32:05 -0400
commit4458fd0cd8fa259f0ee8195e1aa86d5b7c6f8919 (patch)
treeb7b8886da56232e92a0438edd2a869f6964141a4 /src/test/test_containers.c
parent1bfda600c338cd8f7d6b9acc7613b5567e6ee03f (diff)
downloadtor-4458fd0cd8fa259f0ee8195e1aa86d5b7c6f8919.tar.gz
tor-4458fd0cd8fa259f0ee8195e1aa86d5b7c6f8919.zip
In the unit tests, use "test_eq_ptr" and "test_neq_ptr" consistently
This is part of what's needed to build without warnings on mingw64: it was warning about the cast from void* to long that happened in the places we were using test_{n,}eq on pointers. The alternative here would have been to broaden tt_int_op to accept a long long or an intptr_t, but that's less correct (since pointers aren't integers), and would hurt the portability of tinytest a little. Fixes part of 7260.
Diffstat (limited to 'src/test/test_containers.c')
-rw-r--r--src/test/test_containers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_containers.c b/src/test/test_containers.c
index 399ef8e90f..580c5779f0 100644
--- a/src/test/test_containers.c
+++ b/src/test/test_containers.c
@@ -266,7 +266,7 @@ test_container_smartlist_strings(void)
SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
smartlist_clear(sl);
cp_alloc = smartlist_pop_last(sl);
- test_eq(cp_alloc, NULL);
+ test_eq_ptr(cp_alloc, NULL);
/* Test uniq() */
smartlist_split_string(sl,
@@ -677,12 +677,12 @@ test_container_strmap(void)
test_eq(strmap_size(map), 0);
test_assert(strmap_isempty(map));
v = strmap_set(map, "K1", (void*)99);
- test_eq(v, NULL);
+ test_eq_ptr(v, NULL);
test_assert(!strmap_isempty(map));
v = strmap_set(map, "K2", (void*)101);
- test_eq(v, NULL);
+ test_eq_ptr(v, NULL);
v = strmap_set(map, "K1", (void*)100);
- test_eq(v, (void*)99);
+ test_eq_ptr(v, (void*)99);
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);