aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_bwmgt.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-12 13:11:35 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-13 10:41:15 -0400
commit3f514fe3b1d217c80edb1524976203bc535f9502 (patch)
tree133d768dbd10aa7b9caa6e27a2ad4f5321f08616 /src/test/test_bwmgt.c
parentc63761a0a67a2d606deb749a5bcf680de9b3df36 (diff)
downloadtor-3f514fe3b1d217c80edb1524976203bc535f9502.tar.gz
tor-3f514fe3b1d217c80edb1524976203bc535f9502.zip
Accept small hops backward in the monotonic timer.
Diffstat (limited to 'src/test/test_bwmgt.c')
-rw-r--r--src/test/test_bwmgt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/test_bwmgt.c b/src/test/test_bwmgt.c
index 7bcfcf7fe9..2428b15058 100644
--- a/src/test/test_bwmgt.c
+++ b/src/test/test_bwmgt.c
@@ -178,8 +178,13 @@ test_bwmgt_token_buf_refill(void *arg)
tt_int_op(b.read_bucket, OP_GT, 8*KB-200);
tt_int_op(b.read_bucket, OP_LT, 8*KB+200);
- // a ridiculous amount of time passes
+ // We step a second backwards, and nothing happens.
tt_int_op(0, OP_EQ, token_bucket_refill(&b, START_TS + SEC*64));
+ tt_int_op(b.read_bucket, OP_GT, 8*KB-200);
+ tt_int_op(b.read_bucket, OP_LT, 8*KB+200);
+
+ // A ridiculous amount of time passes.
+ tt_int_op(0, OP_EQ, token_bucket_refill(&b, INT32_MAX));
tt_int_op(b.read_bucket, OP_EQ, b.burst);
done: