|
|
|
@ -198,32 +198,31 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
@@ -198,32 +198,31 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
|
|
|
|
|
for (int j = 0; j < 64; j++) { |
|
|
|
|
prevector_tester<8, int> test; |
|
|
|
|
for (int i = 0; i < 2048; i++) { |
|
|
|
|
int r = insecure_rand(); |
|
|
|
|
if ((r % 4) == 0) { |
|
|
|
|
if (insecure_randbits(2) == 0) { |
|
|
|
|
test.insert(insecure_randrange(test.size() + 1), insecure_rand()); |
|
|
|
|
} |
|
|
|
|
if (test.size() > 0 && ((r >> 2) % 4) == 1) { |
|
|
|
|
if (test.size() > 0 && insecure_randbits(2) == 1) { |
|
|
|
|
test.erase(insecure_randrange(test.size())); |
|
|
|
|
} |
|
|
|
|
if (((r >> 4) % 8) == 2) { |
|
|
|
|
if (insecure_randbits(3) == 2) { |
|
|
|
|
int new_size = std::max<int>(0, std::min<int>(30, test.size() + (insecure_randrange(5)) - 2)); |
|
|
|
|
test.resize(new_size); |
|
|
|
|
} |
|
|
|
|
if (((r >> 7) % 8) == 3) { |
|
|
|
|
if (insecure_randbits(3) == 3) { |
|
|
|
|
test.insert(insecure_randrange(test.size() + 1), 1 + insecure_randrange(2), insecure_rand()); |
|
|
|
|
} |
|
|
|
|
if (((r >> 10) % 8) == 4) { |
|
|
|
|
if (insecure_randbits(3) == 4) { |
|
|
|
|
int del = std::min<int>(test.size(), 1 + (insecure_randrange(2))); |
|
|
|
|
int beg = insecure_randrange(test.size() + 1 - del); |
|
|
|
|
test.erase(beg, beg + del); |
|
|
|
|
} |
|
|
|
|
if (((r >> 13) % 16) == 5) { |
|
|
|
|
if (insecure_randbits(4) == 5) { |
|
|
|
|
test.push_back(insecure_rand()); |
|
|
|
|
} |
|
|
|
|
if (test.size() > 0 && ((r >> 17) % 16) == 6) { |
|
|
|
|
if (test.size() > 0 && insecure_randbits(4) == 6) { |
|
|
|
|
test.pop_back(); |
|
|
|
|
} |
|
|
|
|
if (((r >> 21) % 32) == 7) { |
|
|
|
|
if (insecure_randbits(5) == 7) { |
|
|
|
|
int values[4]; |
|
|
|
|
int num = 1 + (insecure_randrange(4)); |
|
|
|
|
for (int k = 0; k < num; k++) { |
|
|
|
@ -231,34 +230,33 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
@@ -231,34 +230,33 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
|
|
|
|
|
} |
|
|
|
|
test.insert_range(insecure_randrange(test.size() + 1), values, values + num); |
|
|
|
|
} |
|
|
|
|
if (((r >> 26) % 32) == 8) { |
|
|
|
|
if (insecure_randbits(5) == 8) { |
|
|
|
|
int del = std::min<int>(test.size(), 1 + (insecure_randrange(4))); |
|
|
|
|
int beg = insecure_randrange(test.size() + 1 - del); |
|
|
|
|
test.erase(beg, beg + del); |
|
|
|
|
} |
|
|
|
|
r = insecure_rand(); |
|
|
|
|
if (r % 32 == 9) { |
|
|
|
|
if (insecure_randbits(5) == 9) { |
|
|
|
|
test.reserve(insecure_randrange(32)); |
|
|
|
|
} |
|
|
|
|
if ((r >> 5) % 64 == 10) { |
|
|
|
|
if (insecure_randbits(6) == 10) { |
|
|
|
|
test.shrink_to_fit(); |
|
|
|
|
} |
|
|
|
|
if (test.size() > 0) { |
|
|
|
|
test.update(insecure_randrange(test.size()), insecure_rand()); |
|
|
|
|
} |
|
|
|
|
if (((r >> 11) % 1024) == 11) { |
|
|
|
|
if (insecure_randbits(10) == 11) { |
|
|
|
|
test.clear(); |
|
|
|
|
} |
|
|
|
|
if (((r >> 21) % 512) == 12) { |
|
|
|
|
if (insecure_randbits(9) == 12) { |
|
|
|
|
test.assign(insecure_randrange(32), insecure_rand()); |
|
|
|
|
} |
|
|
|
|
if (((r >> 15) % 8) == 3) { |
|
|
|
|
if (insecure_randbits(3) == 3) { |
|
|
|
|
test.swap(); |
|
|
|
|
} |
|
|
|
|
if (((r >> 15) % 16) == 8) { |
|
|
|
|
if (insecure_randbits(4) == 8) { |
|
|
|
|
test.copy(); |
|
|
|
|
} |
|
|
|
|
if (((r >> 15) % 32) == 18) { |
|
|
|
|
if (insecure_randbits(5) == 18) { |
|
|
|
|
test.move(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|