Add reserve for bitset

Fix bug in resize for bitset
This commit is contained in:
Patrick Pelissier committed 2017-04-14 11:46:24 +02:00
1 parent 418d868b1d
commit f57968fcd8
2 files changed
+39 -8

No files matched your search

+9
View File
@@ -54,6 +54,15 @@ static void test1(void)
for(int i = 0; i < 50; i ++) {
assert (bitset_get(set2, i) == (i%2));
}
bitset_reserve(set2, 100);
assert(bitset_capacity(set2) >= 100); // rounded
bitset_reserve(set2, 0);
assert(bitset_capacity(set2) >= 50 && bitset_capacity(set2) < 100); // rounded
bitset_resize(set2, 100);
for(int i = 50; i < 100; i ++) {
assert (bitset_get(set2, i) == false);
}
bitset_resize(set2, 50);
// Push from 0
bitset_push_at(set2, 0, 1);