summaryrefslogtreecommitdiff
path: root/src/test/test.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-08-14 08:48:26 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-14 08:48:26 -0400
commit05d52899cbdc7a16d4e9b93555a081d16b06d96b (patch)
tree372dac41ea28f7e9e203af1bb14684aedd5741f8 /src/test/test.h
parent34aefe6f38716ad88f07aa479f09008ed9d179b2 (diff)
downloadtor-05d52899cbdc7a16d4e9b93555a081d16b06d96b.tar.gz
tor-05d52899cbdc7a16d4e9b93555a081d16b06d96b.zip
Fix an overzealous compiler warning in the tests
Diffstat (limited to 'src/test/test.h')
-rw-r--r--src/test/test.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test.h b/src/test/test.h
index b0c0946ac4..86699c3d07 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -40,6 +40,15 @@
tt_assert_test_type(a,b,#a" "#op" "#b,double,(val1_ op val2_),"%g", \
TT_EXIT_TEST_FUNCTION)
+/* Declare "double equal" in a sneaky way, so compiler won't complain about
+ * comparing floats with == or !=. Of course, only do this if you know what
+ * you're doing. */
+#define tt_double_eq(a,b) \
+ STMT_BEGIN \
+ tt_double_op((a), >=, (b)); \
+ tt_double_op((a), <=, (b)); \
+ STMT_END
+
#ifdef _MSC_VER
#define U64_PRINTF_TYPE uint64_t
#define I64_PRINTF_TYPE int64_t