aboutsummaryrefslogtreecommitdiff
path: root/src/common/test.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-08-12 17:24:53 +0000
committerNick Mathewson <nickm@torproject.org>2005-08-12 17:24:53 +0000
commit789374dbbd6931fb9749161ea2882fccfc172343 (patch)
treecdb535dd3382ff2a5265ac67ccb419253aa31d1c /src/common/test.h
parent21959c1bfd8bbc465a330fe8d9ad52518de51f71 (diff)
downloadtor-789374dbbd6931fb9749161ea2882fccfc172343.tar
tor-789374dbbd6931fb9749161ea2882fccfc172343.tar.gz
Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.
svn:r4770
Diffstat (limited to 'src/common/test.h')
-rw-r--r--src/common/test.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/common/test.h b/src/common/test.h
index 34845146d..99abc0b5a 100644
--- a/src/common/test.h
+++ b/src/common/test.h
@@ -49,21 +49,28 @@ extern int have_failed;
return; \
} STMT_END
-#define test_eq(expr1, expr2) \
- STMT_BEGIN \
- long v1=(long)(expr1), v2=(long)(expr2); \
- if (v1==v2) { printf("."); fflush(stdout); } else { \
- have_failed = 1; \
- printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\
- " (%ld != %ld)\n", \
- _SHORT_FILE_, \
- __LINE__, \
- PRETTY_FUNCTION, \
- #expr1, #expr2, \
- v1, v2); \
- return; \
+#define test_eq_type(tp, fmt, expr1, expr2) \
+ STMT_BEGIN \
+ tp v1=(tp)(expr1); \
+ tp v2=(tp)(expr2); \
+ if (v1==v2) { printf("."); fflush(stdout); } else { \
+ have_failed = 1; \
+ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n" \
+ " "fmt "!="fmt"\n", \
+ _SHORT_FILE_, \
+ __LINE__, \
+ PRETTY_FUNCTION, \
+ #expr1, #expr2, \
+ v1, v2); \
+ return; \
} STMT_END
+#define test_eq(expr1, expr2) \
+ test_eq_type(long, "%ld", expr1, expr2)
+
+#define test_eq_ptr(expr1, expr2) \
+ test_eq_type(void*, "%p", expr1, expr2)
+
#define test_neq(expr1, expr2) \
STMT_BEGIN \
long v1=(long)(expr1), v2=(long)(expr2); \