aboutsummaryrefslogtreecommitdiff
path: root/src/test/test.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-05-08 14:01:17 -0400
committerNick Mathewson <nickm@torproject.org>2014-05-08 14:01:17 -0400
commit28538069b2f1909a7600ec6d25f8efb78be496fd (patch)
treec6f935a3dd34c0604d6219e792ede4c691b29f76 /src/test/test.h
parentdf684789380a51c9de14120160adfb796d891436 (diff)
downloadtor-28538069b2f1909a7600ec6d25f8efb78be496fd.tar.gz
tor-28538069b2f1909a7600ec6d25f8efb78be496fd.zip
Fix numerous 64->32 errors in the unit tests
Before the 11825 fix, these were all silently ignored.
Diffstat (limited to 'src/test/test.h')
-rw-r--r--src/test/test.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/test.h b/src/test/test.h
index 0ccf6c718e..712183f4b2 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -59,6 +59,29 @@
tt_assert_test_type(a,b,#a" "#op" "#b,double,(val1_ op val2_),"%f", \
TT_EXIT_TEST_FUNCTION)
+#ifdef _MSC_VER
+#define U64_PRINTF_TYPE uint64_t
+#define U64_PRINTF_TYPE int64_t
+#else
+#define U64_PRINTF_TYPE unsigned long long
+#define I64_PRINTF_TYPE long long
+#endif
+
+#define tt_size_op(a,op,b) \
+ tt_assert_test_fmt_type(a,b,#a" "#op" "#b,size_t,(val1_ op val2_), \
+ U64_PRINTF_TYPE, U64_FORMAT, \
+ {print_ = (U64_PRINTF_TYPE) value_;},{},TT_EXIT_TEST_FUNCTION)
+
+#define tt_u64_op(a,op,b) \
+ tt_assert_test_fmt_type(a,b,#a" "#op" "#b,uint64_t,(val1_ op val2_), \
+ U64_PRINTF_TYPE, U64_FORMAT, \
+ {print_ = (U64_PRINTF_TYPE) value_;},{},TT_EXIT_TEST_FUNCTION)
+
+#define tt_i64_op(a,op,b) \
+ tt_assert_test_fmt_type(a,b,#a" "#op" "#b,int64_t,(val1_ op val2_), \
+ I64_PRINTF_TYPE, I64_FORMAT, \
+ {print_ = (I64_PRINTF_TYPE) value_;},{},TT_EXIT_TEST_FUNCTION)
+
const char *get_fname(const char *name);
crypto_pk_t *pk_generate(int idx);