]> git.ozlabs.org Git - ccan/blob - ccan/tally/test/run-renormalize.c
gitify the tree, especially the web makefile.
[ccan] / ccan / tally / test / run-renormalize.c
1 #include <ccan/tally/tally.c>
2 #include <ccan/tap/tap.h>
3
4 int main(void)
5 {
6         struct tally *tally = tally_new(2);
7
8         plan_tests(4);
9         tally->min = 0;
10         tally->max = 0;
11         tally->counts[0] = 1;
12
13         /* This renormalize should do nothing. */
14         renormalize(tally, 0, 1);
15         ok1(tally->counts[0] == 1);
16         ok1(tally->counts[1] == 0);
17         tally->counts[1]++;
18
19         /* This renormalize should collapse both into bucket 0. */
20         renormalize(tally, 0, 3);
21         ok1(tally->counts[0] == 2);
22         ok1(tally->counts[1] == 0);
23
24         return exit_status();
25 }