]> git.ozlabs.org Git - ccan/blobdiff - ccan/time/test/run-monotonic.c
time: test/run-monotonic backwards timemono_between fix.
[ccan] / ccan / time / test / run-monotonic.c
index 787ca6820b4c5c1976cdcaae526475eb506fd48f..2da492d441b0160731ce4f431d31031c9b7e67a3 100644 (file)
@@ -7,7 +7,7 @@ int main(void)
        struct timemono t1, t2;
        struct timerel t3;
 
-       plan_tests(3);
+       plan_tests(5);
 
        /* Test time_mono */
        t1 = time_mono();
@@ -18,8 +18,11 @@ int main(void)
        t3.ts.tv_sec = 1;
        t3.ts.tv_nsec = 0;
 
-       ok1(time_less(timemono_between(t1, t2), t3));
+       ok1(time_less(timemono_between(t2, t1), t3));
        ok1(time_less(timemono_since(t1), t3));
 
+       ok1(timemono_add(t1, t3).ts.tv_sec == t1.ts.tv_sec + 1);
+       ok1(timemono_add(t2, t3).ts.tv_nsec == t2.ts.tv_nsec);
+
        return exit_status();
 }