s4 dns: Implement RFC-compatible update prescan
[Samba/gebeck_regimport.git] / lib / ccan / tally / test / run-renormalize.c
blob8fe9dbce329c1576a9762c2e14a0ca03123cc4ff
1 #include <ccan/tally/tally.c>
2 #include <ccan/tap/tap.h>
4 int main(void)
6 struct tally *tally = tally_new(2);
8 plan_tests(4);
9 tally->min = 0;
10 tally->max = 0;
11 tally->counts[0] = 1;
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]++;
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);
24 free(tally);
25 return exit_status();