aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_tortls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-30 12:54:31 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-11 10:11:52 -0400
commit493499a3399f8a8532b4b2a80006c033e8f64c58 (patch)
treefb1965c627838137ecd4634fba00cbcccd253372 /src/test/test_tortls.c
parent2ff20c93a5ec753a0c46ca5ecd991b8e2020f7d0 (diff)
downloadtor-493499a3399f8a8532b4b2a80006c033e8f64c58.tar.gz
tor-493499a3399f8a8532b4b2a80006c033e8f64c58.zip
Add -Wfloat-conversion for GCC >= 4.9
This caught quite a few minor issues in our unit tests and elsewhere in our code.
Diffstat (limited to 'src/test/test_tortls.c')
-rw-r--r--src/test/test_tortls.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 973e727b46..caaada8701 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -8,6 +8,7 @@
#ifdef _WIN32
#include <winsock2.h>
#endif
+#include <math.h>
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
@@ -1194,17 +1195,17 @@ test_tortls_get_write_overhead_ratio(void *ignored)
total_bytes_written_over_tls = 0;
ret = tls_get_write_overhead_ratio();
- tt_int_op(ret, OP_EQ, 1.0);
+ tt_double_op(fabs(ret - 1.0), OP_LT, 1E-12);
total_bytes_written_by_tls = 10;
total_bytes_written_over_tls = 1;
ret = tls_get_write_overhead_ratio();
- tt_int_op(ret, OP_EQ, 10.0);
+ tt_double_op(fabs(ret - 10.0), OP_LT, 1E-12);
total_bytes_written_by_tls = 10;
total_bytes_written_over_tls = 2;
ret = tls_get_write_overhead_ratio();
- tt_int_op(ret, OP_EQ, 5.0);
+ tt_double_op(fabs(ret - 5.0), OP_LT, 1E-12);
done:
(void)0;