Skip to content

Commit

Permalink
Add a unit test that we allow huge capacities
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Aug 5, 2023
1 parent 6a93c23 commit 8efd36b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/toplevel_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,13 @@ DEFINE_TEST(test_stats) {
roaring_bitmap_free(r1);
}

DEFINE_TEST(with_huge_capacity) {
roaring_bitmap_t *r = roaring_bitmap_create_with_capacity(UINT32_MAX);
assert_non_null(r);
assert_int_equal(r->high_low_container.allocation_size, 0x1000);
roaring_bitmap_free(r);
}

// this should expose memory leaks
// (https://github.com/RoaringBitmap/CRoaring/pull/70)
void leaks_with_empty(bool copy_on_write) {
Expand Down Expand Up @@ -4623,6 +4630,7 @@ int main() {
cmocka_unit_test(test_silly_range),
cmocka_unit_test(test_uint32_iterator_true),
cmocka_unit_test(test_uint32_iterator_false),
cmocka_unit_test(with_huge_capacity),
cmocka_unit_test(leaks_with_empty_true),
cmocka_unit_test(leaks_with_empty_false),
cmocka_unit_test(test_bitmap_from_range),
Expand Down

0 comments on commit 8efd36b

Please sign in to comment.