Changeset View
Changeset View
Standalone View
Standalone View
src/test/prevector_tests.cpp
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | for (int j = 0; j < 64; j++) { | ||||
if (InsecureRandBits(2) == 0) { | if (InsecureRandBits(2) == 0) { | ||||
test.insert(InsecureRandRange(test.size() + 1), | test.insert(InsecureRandRange(test.size() + 1), | ||||
insecure_rand()); | insecure_rand()); | ||||
} | } | ||||
if (test.size() > 0 && InsecureRandBits(2) == 1) { | if (test.size() > 0 && InsecureRandBits(2) == 1) { | ||||
test.erase(InsecureRandRange(test.size())); | test.erase(InsecureRandRange(test.size())); | ||||
} | } | ||||
if (InsecureRandBits(3) == 2) { | if (InsecureRandBits(3) == 2) { | ||||
int new_size = std::max<int>( | int new_size = std::max( | ||||
0, std::min<int>(30, | 0, std::min(30, int(test.size()) + | ||||
test.size() + (InsecureRandRange(5)) - 2)); | int(InsecureRandRange(5)) - 2)); | ||||
test.resize(new_size); | test.resize(new_size); | ||||
} | } | ||||
if (InsecureRandBits(3) == 3) { | if (InsecureRandBits(3) == 3) { | ||||
test.insert(InsecureRandRange(test.size() + 1), | test.insert(InsecureRandRange(test.size() + 1), | ||||
1 + InsecureRandBool(), insecure_rand()); | 1 + InsecureRandBool(), insecure_rand()); | ||||
} | } | ||||
if (InsecureRandBits(3) == 4) { | if (InsecureRandBits(3) == 4) { | ||||
int del = std::min<int>(test.size(), 1 + (InsecureRandBool())); | int del = std::min<int>(test.size(), 1 + (InsecureRandBool())); | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |