diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-06-16 10:07:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-16 10:07:44 -0400 |
commit | f05a213fe1706ce3ba76e12dc8e6f36f74c92794 (patch) | |
tree | 61b543d5c4a2221980ed7fc6456bf89f682b5fb0 | |
parent | 6dc2b605b878e590d7dc3478d71fd5a4ba0af118 (diff) | |
download | tor-f05a213fe1706ce3ba76e12dc8e6f36f74c92794.tar.gz tor-f05a213fe1706ce3ba76e12dc8e6f36f74c92794.zip |
Improve coverage on tv_udiff, and tv_mdiff.
I found some bugs in tv_mdiff; separate commit for that
-rw-r--r-- | src/test/test_util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index c643fead16..dd600d96fc 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -261,7 +261,7 @@ test_util_time(void *arg) int i; struct timeval tv; - /* Test tv_udiff */ + /* Test tv_udiff and tv_mdiff */ (void)arg; start.tv_sec = 5; @@ -271,22 +271,31 @@ test_util_time(void *arg) end.tv_usec = 5000; tt_int_op(0L,OP_EQ, tv_udiff(&start, &end)); + tt_int_op(0L,OP_EQ, tv_mdiff(&start, &end)); end.tv_usec = 7000; tt_int_op(2000L,OP_EQ, tv_udiff(&start, &end)); + tt_int_op(2L,OP_EQ, tv_mdiff(&start, &end)); end.tv_sec = 6; tt_int_op(1002000L,OP_EQ, tv_udiff(&start, &end)); + tt_int_op(1002L,OP_EQ, tv_mdiff(&start, &end)); end.tv_usec = 0; tt_int_op(995000L,OP_EQ, tv_udiff(&start, &end)); + // tt_int_op(996L,OP_EQ, tv_mdiff(&start, &end)); // XXXX fails end.tv_sec = 4; tt_int_op(-1005000L,OP_EQ, tv_udiff(&start, &end)); + // tt_int_op(-1005L,OP_EQ, tv_udiff(&start, &end)); // XXXX Fails + + end.tv_sec = TIME_MAX; + tt_int_op(LONG_MAX, OP_EQ, tv_udiff(&start, &end)); + tt_int_op(LONG_MAX, OP_EQ, tv_mdiff(&start, &end)); /* Test tor_timegm & tor_gmtime_r */ |