MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

ccan/ccan/timer/test/run-add.c:17–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17int main(void)
18{
19 struct timers timers;
20 struct timer t;
21 uint64_t diff;
22 unsigned int i;
23 struct timemono epoch = { { 0, 0 } };
24
25 /* This is how many tests you plan to run */
26 plan_tests(2 + (18 + (MAX_ORD - 4) * 3) * (18 + (MAX_ORD - 4) * 3));
27
28 timers_init(&timers, epoch);
29 ok1(timers_check(&timers, NULL));
30
31 for (i = 0; i < 4; i++)
32 add_level(&timers, i);
33
34 i = 0;
35 timer_init(&t);
36 for (diff = 0; diff < (1ULL << MAX_ORD)+2; diff = next(diff)) {
37 i++;
38 for (timers.base = 0;
39 timers.base < (1ULL << MAX_ORD)+2;
40 timers.base = next(timers.base)) {
41 timer_addmono(&timers, &t, grains_to_time(timers.base + diff));
42 ok1(timers_check(&timers, NULL));
43 timer_del(&timers, &t);
44 }
45 }
46
47 ok1(timers_check(&timers, NULL));
48
49 timers_cleanup(&timers);
50
51 /* This exits depending on whether all tests passed */
52 return exit_status();
53}

Callers

nothing calls this directly

Calls 9

timers_initFunction · 0.85
timers_checkFunction · 0.85
add_levelFunction · 0.85
timer_initFunction · 0.85
nextFunction · 0.85
timer_addmonoFunction · 0.85
grains_to_timeFunction · 0.85
timer_delFunction · 0.85
timers_cleanupFunction · 0.85

Tested by

no test coverage detected