From c2ccadc26a04358b11539097c1aadb8d11b85c21 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 6 Apr 2020 14:37:37 -0700 Subject: [PATCH] Merge and generalize case 3 and case 6 --- src/test/fuzz/prevector.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/test/fuzz/prevector.cpp b/src/test/fuzz/prevector.cpp index 39320c12166..4154d9c7130 100644 --- a/src/test/fuzz/prevector.cpp +++ b/src/test/fuzz/prevector.cpp @@ -189,7 +189,7 @@ void test_one_input(const std::vector& buffer) prevector_tester<8, int> test; while (prov.remaining_bytes()) { - switch (prov.ConsumeIntegralInRange(0, 14 + 3 * (test.size() > 0))) { + switch (prov.ConsumeIntegralInRange(0, 13 + 3 * (test.size() > 0))) { case 0: test.insert(prov.ConsumeIntegralInRange(0, test.size()), prov.ConsumeIntegral()); break; @@ -203,7 +203,7 @@ void test_one_input(const std::vector& buffer) test.insert(prov.ConsumeIntegralInRange(0, test.size()), 1 + prov.ConsumeBool(), prov.ConsumeIntegral()); break; case 3: { - int del = std::min(test.size(), 1 + prov.ConsumeBool()); + int del = prov.ConsumeIntegralInRange(0, test.size()); int beg = prov.ConsumeIntegralInRange(0, test.size() - del); test.erase(beg, beg + del); break; @@ -223,19 +223,13 @@ void test_one_input(const std::vector& buffer) test.insert_range(prov.ConsumeIntegralInRange(0, test.size()), values, values + num); break; } - case 6: { - int del = std::min(test.size(), 1 + prov.ConsumeIntegralInRange(0, 3)); - int beg = prov.ConsumeIntegralInRange(0, test.size() - del); - test.erase(beg, beg + del); - break; - } case 7: test.reserve(prov.ConsumeIntegralInRange(0, 32767)); break; case 8: test.shrink_to_fit(); break; - case 17: + case 14: test.update(prov.ConsumeIntegralInRange(0, test.size() - 1), prov.ConsumeIntegral()); break; case 9: @@ -253,7 +247,7 @@ void test_one_input(const std::vector& buffer) case 13: test.move(); break; - case 14: { + case 6: { int num = 1 + prov.ConsumeIntegralInRange(0, 15); std::vector values(num); for (auto& v : values) {