Skip to content

Commit c2ccadc

Browse files
committed
Merge and generalize case 3 and case 6
1 parent 402ad5a commit c2ccadc

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/test/fuzz/prevector.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
189189
prevector_tester<8, int> test;
190190

191191
while (prov.remaining_bytes()) {
192-
switch (prov.ConsumeIntegralInRange<int>(0, 14 + 3 * (test.size() > 0))) {
192+
switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) {
193193
case 0:
194194
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>());
195195
break;
@@ -203,7 +203,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
203203
test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), 1 + prov.ConsumeBool(), prov.ConsumeIntegral<int>());
204204
break;
205205
case 3: {
206-
int del = std::min<int>(test.size(), 1 + prov.ConsumeBool());
206+
int del = prov.ConsumeIntegralInRange<int>(0, test.size());
207207
int beg = prov.ConsumeIntegralInRange<int>(0, test.size() - del);
208208
test.erase(beg, beg + del);
209209
break;
@@ -223,19 +223,13 @@ void test_one_input(const std::vector<uint8_t>& buffer)
223223
test.insert_range(prov.ConsumeIntegralInRange<size_t>(0, test.size()), values, values + num);
224224
break;
225225
}
226-
case 6: {
227-
int del = std::min<int>(test.size(), 1 + prov.ConsumeIntegralInRange<int>(0, 3));
228-
int beg = prov.ConsumeIntegralInRange<int>(0, test.size() - del);
229-
test.erase(beg, beg + del);
230-
break;
231-
}
232226
case 7:
233227
test.reserve(prov.ConsumeIntegralInRange<size_t>(0, 32767));
234228
break;
235229
case 8:
236230
test.shrink_to_fit();
237231
break;
238-
case 17:
232+
case 14:
239233
test.update(prov.ConsumeIntegralInRange<size_t>(0, test.size() - 1), prov.ConsumeIntegral<int>());
240234
break;
241235
case 9:
@@ -253,7 +247,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
253247
case 13:
254248
test.move();
255249
break;
256-
case 14: {
250+
case 6: {
257251
int num = 1 + prov.ConsumeIntegralInRange<int>(0, 15);
258252
std::vector<int> values(num);
259253
for (auto& v : values) {

0 commit comments

Comments
 (0)