* tests/test-bitset.c: Display the stats at the end of the test.
* lib/bitset/stats.c (bitset_log_histogram_print): When diplaying the
last bin, display "256-..." rather that "256-511", since the last bin
does count item greater than or equal to 256.
+2020-11-19 Akim Demaille <akim@lrde.epita.fr>
+
+ bitset: tests: exercise the stats too
+
+ * tests/test-bitset.c: Display the stats at the end of the test.
+ * lib/bitset/stats.c (bitset_log_histogram_print): When diplaying the
+ last bin, display "256-..." rather that "256-511", since the last bin
+ does count item greater than or equal to 256.
+
2020-11-19 Akim Demaille <akim@lrde.epita.fr>
bitset: tests: try harder to break it
fprintf (file, "%*d\t%8u (%5.1f%%)\n",
max_width, i, bins[i], 100.0 * bins[i] / total);
- for (; i < n_bins; i++)
+ for (; i < n_bins - 1; i++)
fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n",
max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
1UL << (i - 1),
(1UL << i) - 1,
bins[i],
(100.0 * bins[i]) / total);
+
+ fprintf (file, "%*lu-...\t%8u (%5.1f%%)\n",
+ max_width - ((unsigned) (0.30103 * (i) + 0.9999) + 1),
+ 1UL << (i - 1),
+ bins[i],
+ (100.0 * bins[i]) / total);
}
}
int main (void)
{
+ bitset_stats_enable ();
+
for (int i = 0; i < 4; ++i)
{
/* table bitsets have elements that store 256 bits. bitset_list
compare (BITSET_VARIABLE, BITSET_SPARSE);
compare (BITSET_VARIABLE, BITSET_FRUGAL);
compare (BITSET_VARIABLE, BITSET_GREEDY);
+
+ bitset_stats_dump (stderr);
return 0;
}