diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-05-30 12:54:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-11 10:11:52 -0400 |
commit | 493499a3399f8a8532b4b2a80006c033e8f64c58 (patch) | |
tree | fb1965c627838137ecd4634fba00cbcccd253372 /src/test/test_util.c | |
parent | 2ff20c93a5ec753a0c46ca5ecd991b8e2020f7d0 (diff) | |
download | tor-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_util.c')
-rw-r--r-- | src/test/test_util.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 2726c31fe8..05c7d60ea9 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1472,24 +1472,24 @@ test_util_strmisc(void *arg) { /* Test parse_double */ - double d = tor_parse_double("10", 0, UINT64_MAX,&i,NULL); + double d = tor_parse_double("10", 0, (double)UINT64_MAX,&i,NULL); tt_int_op(1,OP_EQ, i); tt_assert(DBL_TO_U64(d) == 10); - d = tor_parse_double("0", 0, UINT64_MAX,&i,NULL); + d = tor_parse_double("0", 0, (double)UINT64_MAX,&i,NULL); tt_int_op(1,OP_EQ, i); tt_assert(DBL_TO_U64(d) == 0); - d = tor_parse_double(" ", 0, UINT64_MAX,&i,NULL); + d = tor_parse_double(" ", 0, (double)UINT64_MAX,&i,NULL); tt_int_op(0,OP_EQ, i); - d = tor_parse_double(".0a", 0, UINT64_MAX,&i,NULL); + d = tor_parse_double(".0a", 0, (double)UINT64_MAX,&i,NULL); tt_int_op(0,OP_EQ, i); - d = tor_parse_double(".0a", 0, UINT64_MAX,&i,&cp); + d = tor_parse_double(".0a", 0, (double)UINT64_MAX,&i,&cp); tt_int_op(1,OP_EQ, i); - d = tor_parse_double("-.0", 0, UINT64_MAX,&i,NULL); + d = tor_parse_double("-.0", 0, (double)UINT64_MAX,&i,NULL); tt_int_op(1,OP_EQ, i); tt_assert(DBL_TO_U64(d) == 0); d = tor_parse_double("-10", -100.0, 100.0,&i,NULL); tt_int_op(1,OP_EQ, i); - tt_int_op(-10.0,OP_EQ, d); + tt_double_op(fabs(d - -10.0),OP_LT, 1E-12); } { |