summaryrefslogtreecommitdiff
path: root/src/common/test.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-03-25 20:20:45 +0000
committerNick Mathewson <nickm@torproject.org>2008-03-25 20:20:45 +0000
commitdf6b256bc01024fd8c4fdfd2cda4b906638a651f (patch)
treefe683f6de6fa2f902983169ea4b0262bf07ae753 /src/common/test.h
parent55ca7e15fb169c76c8b70c2550bae30b483af61e (diff)
downloadtor-df6b256bc01024fd8c4fdfd2cda4b906638a651f.tar.gz
tor-df6b256bc01024fd8c4fdfd2cda4b906638a651f.zip
r19041@catbus: nickm | 2008-03-25 16:20:42 -0400
More unit tests to improve coverage. svn:r14185
Diffstat (limited to 'src/common/test.h')
-rw-r--r--src/common/test.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/test.h b/src/common/test.h
index c07d34351f..4709595cf9 100644
--- a/src/common/test.h
+++ b/src/common/test.h
@@ -144,25 +144,25 @@ extern int have_failed;
#define test_memeq_hex(expr1, hex) \
STMT_BEGIN \
- const void *_test_v1 = (expr1); \
+ const char *_test_v1 = (char*)(expr1); \
const char *_test_v2 = (hex); \
size_t _len_v2 = strlen(_test_v2); \
- char *mem2 = tor_malloc(_len_v2/2); \
+ char *_mem2 = tor_malloc(_len_v2/2); \
tor_assert((_len_v2 & 1) == 0); \
- base16_decode(mem2, _len_v2/2, _test_v2, _len_v2); \
- if (!memcmp(mem2, _test_v1, _len_v2/2)) { \
+ base16_decode(_mem2, _len_v2/2, _test_v2, _len_v2); \
+ if (!memcmp(_mem2, _test_v1, _len_v2/2)) { \
printf("."); fflush(stdout); } else { \
- char *mem1 = tor_malloc(_len_v2)+1; \
- base16_encode(mem1, _len_v2+1, _test_v1, _len_v2/2); \
+ char *_mem1 = tor_malloc(_len_v2+1); \
+ base16_encode(_mem1, _len_v2+1, _test_v1, _len_v2/2); \
printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n" \
" %s != %s\n", \
_SHORT_FILE_, \
__LINE__, \
PRETTY_FUNCTION, \
- #expr1, _test_v2, mem1, _test_v2); \
+ #expr1, _test_v2, _mem1, _test_v2); \
return; \
} \
- tor_free(mem2); \
+ tor_free(_mem2); \
STMT_END
#define test_memneq(expr1, expr2, len) \