1 #include <ccan/timer/timer.h>
2 /* Include the C files directly. */
3 #include <ccan/timer/timer.c>
4 #include <ccan/tap/tap.h>
6 /* More than 32 bits */
9 /* 0...17, 63, 64, 65, 127, 128, 129, 255, 256, 257, ... */
10 static uint64_t next(uint64_t base)
12 if (base > 16 && ((base - 1) & ((base - 1) >> 1)) == 0)
24 /* This is how many tests you plan to run */
25 plan_tests(2 + (18 + (MAX_ORD - 4) * 3) * (18 + (MAX_ORD - 4) * 3));
27 timers_init(&timers, time_from_nsec(0));
28 ok1(timers_check(&timers, NULL));
30 for (i = 0; i < 4; i++)
31 add_level(&timers, i);
34 for (diff = 0; diff < (1ULL << MAX_ORD)+2; diff = next(diff)) {
37 timers.base < (1ULL << MAX_ORD)+2;
38 timers.base = next(timers.base)) {
39 timer_add(&timers, &t, grains_to_time(timers.base + diff));
40 ok1(timers_check(&timers, NULL));
41 timer_del(&timers, &t);
45 ok1(timers_check(&timers, NULL));
47 timers_cleanup(&timers);
49 /* This exits depending on whether all tests passed */