mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Improve add_msec test to cover ms->sec rollover
Per mikeperry's suggestion, I'm making sure that the millisecond part of the time will always roll over in this test.
This commit is contained in:
parent
219c969d7b
commit
60bf8f6cf6
1 changed files with 10 additions and 0 deletions
|
@ -5970,6 +5970,16 @@ test_util_monotonic_time_add_msec(void *arg)
|
|||
tt_i64_op(monotime_diff_msec(&t1, &t2), OP_EQ, 1337);
|
||||
tt_i64_op(monotime_coarse_diff_msec(&ct1, &ct2), OP_EQ, 1337);
|
||||
|
||||
/* Add 1337 msec twice more; make sure that any second rollover issues
|
||||
* worked. */
|
||||
monotime_add_msec(&t2, &t2, 1337);
|
||||
monotime_coarse_add_msec(&ct2, &ct2, 1337);
|
||||
monotime_add_msec(&t2, &t2, 1337);
|
||||
monotime_coarse_add_msec(&ct2, &ct2, 1337);
|
||||
tt_i64_op(monotime_diff_msec(&t1, &t2), OP_EQ, 1337*3);
|
||||
tt_i64_op(monotime_coarse_diff_msec(&ct1, &ct2), OP_EQ, 1337*3);
|
||||
|
||||
|
||||
done:
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue