diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-11-02 14:32:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-11-02 14:32:05 -0400 |
commit | 4458fd0cd8fa259f0ee8195e1aa86d5b7c6f8919 (patch) | |
tree | b7b8886da56232e92a0438edd2a869f6964141a4 /src/test/test_util.c | |
parent | 1bfda600c338cd8f7d6b9acc7613b5567e6ee03f (diff) | |
download | tor-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_util.c')
-rw-r--r-- | src/test/test_util.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 04ca42dcd9..02a00d0ac8 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1005,7 +1005,7 @@ test_util_strmisc(void) const char *s = "abcdefghijklmnopqrstuvwxyz"; cp = tor_strndup(s, 30); test_streq(cp, s); /* same string, */ - test_neq(cp, s); /* but different pointers. */ + test_neq_ptr(cp, s); /* but different pointers. */ tor_free(cp); cp = tor_strndup(s, 5); @@ -1015,7 +1015,7 @@ test_util_strmisc(void) s = "a\0b\0c\0d\0e\0"; cp = tor_memdup(s,10); test_memeq(cp, s, 10); /* same ram, */ - test_neq(cp, s); /* but different pointers. */ + test_neq_ptr(cp, s); /* but different pointers. */ tor_free(cp); } @@ -1495,7 +1495,7 @@ test_util_mmap(void) /* Now a zero-length file. */ write_str_to_file(fname1, "", 1); mapping = tor_mmap_file(fname1); - test_eq(mapping, NULL); + test_eq_ptr(mapping, NULL); test_eq(ERANGE, errno); unlink(fname1); @@ -1889,7 +1889,7 @@ test_util_memarea(void) /* Make sure we don't overalign. */ p1 = memarea_alloc(area, 1); p2 = memarea_alloc(area, 1); - test_eq(p1+sizeof(void*), p2); + test_eq_ptr(p1+sizeof(void*), p2); { malloced_ptr = tor_malloc(64); test_assert(!memarea_owns_ptr(area, malloced_ptr)); @@ -1934,7 +1934,7 @@ test_util_memarea(void) memarea_clear(area); p1 = memarea_alloc(area, 1); - test_eq(p1, p1_orig); + test_eq_ptr(p1, p1_orig); memarea_clear(area); /* Check for running over an area's size. */ |