diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-09-20 10:43:08 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-20 10:43:08 -0400 |
commit | 1f377e910f89753f6e64a4f9ddc2ff9c35d1e341 (patch) | |
tree | 44144764cc26c0a984bd9b0bc5075dc0bcd0be28 /src/test/test_circuitmux.c | |
parent | 119159677be14351ebcae647d3988f4f2fd9eb72 (diff) | |
parent | 163230e2405af394ce3684dc7fdf2475bf1318b0 (diff) | |
download | tor-1f377e910f89753f6e64a4f9ddc2ff9c35d1e341.tar.gz tor-1f377e910f89753f6e64a4f9ddc2ff9c35d1e341.zip |
Merge branch 'maint-0.3.4'
Diffstat (limited to 'src/test/test_circuitmux.c')
-rw-r--r-- | src/test/test_circuitmux.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index 1d46f8de0d..1be2ff5281 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -15,6 +15,8 @@ #include "core/or/destroy_cell_queue_st.h" +#include <math.h> + /* XXXX duplicated function from test_circuitlist.c */ static channel_t * new_fake_channel(void) @@ -105,16 +107,19 @@ test_cmux_compute_ticks(void *arg) monotime_coarse_set_mock_time_nsec(now); tick = cell_ewma_get_current_tick_and_fraction(&rem); tt_uint_op(tick, OP_EQ, tick_zero); - tt_double_op(rem, OP_GT, .149999999); - tt_double_op(rem, OP_LT, .150000001); +#ifdef USING_32BIT_MSEC_HACK + const double tolerance = .0005; +#else + const double tolerance = .00000001; +#endif + tt_double_op(fabs(rem - .15), OP_LT, tolerance); /* 25 second later and we should be in another tick. */ now = START_NS + NS_PER_S * 25; monotime_coarse_set_mock_time_nsec(now); tick = cell_ewma_get_current_tick_and_fraction(&rem); tt_uint_op(tick, OP_EQ, tick_zero + 2); - tt_double_op(rem, OP_GT, .499999999); - tt_double_op(rem, OP_LT, .500000001); + tt_double_op(fabs(rem - .5), OP_LT, tolerance); done: ; |