diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2020-04-06 14:37:37 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2020-04-06 14:39:42 -0700 |
commit | c2ccadc26a04358b11539097c1aadb8d11b85c21 (patch) | |
tree | 5ccb80d89df5e0715e210b7427d538c88fc12925 /src/test/fuzz | |
parent | 402ad5aaca9509d45d861d77eb6431d6e1944f91 (diff) | |
download | bitcoin-c2ccadc26a04358b11539097c1aadb8d11b85c21.tar.xz |
Merge and generalize case 3 and case 6
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/prevector.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/test/fuzz/prevector.cpp b/src/test/fuzz/prevector.cpp index 39320c1216..4154d9c713 100644 --- a/src/test/fuzz/prevector.cpp +++ b/src/test/fuzz/prevector.cpp @@ -189,7 +189,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) prevector_tester<8, int> test; while (prov.remaining_bytes()) { - switch (prov.ConsumeIntegralInRange<int>(0, 14 + 3 * (test.size() > 0))) { + switch (prov.ConsumeIntegralInRange<int>(0, 13 + 3 * (test.size() > 0))) { case 0: test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), prov.ConsumeIntegral<int>()); break; @@ -203,7 +203,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) test.insert(prov.ConsumeIntegralInRange<size_t>(0, test.size()), 1 + prov.ConsumeBool(), prov.ConsumeIntegral<int>()); break; case 3: { - int del = std::min<int>(test.size(), 1 + prov.ConsumeBool()); + int del = prov.ConsumeIntegralInRange<int>(0, test.size()); int beg = prov.ConsumeIntegralInRange<int>(0, test.size() - del); test.erase(beg, beg + del); break; @@ -223,19 +223,13 @@ void test_one_input(const std::vector<uint8_t>& buffer) test.insert_range(prov.ConsumeIntegralInRange<size_t>(0, test.size()), values, values + num); break; } - case 6: { - int del = std::min<int>(test.size(), 1 + prov.ConsumeIntegralInRange<int>(0, 3)); - int beg = prov.ConsumeIntegralInRange<int>(0, test.size() - del); - test.erase(beg, beg + del); - break; - } case 7: test.reserve(prov.ConsumeIntegralInRange<size_t>(0, 32767)); break; case 8: test.shrink_to_fit(); break; - case 17: + case 14: test.update(prov.ConsumeIntegralInRange<size_t>(0, test.size() - 1), prov.ConsumeIntegral<int>()); break; case 9: @@ -253,7 +247,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) case 13: test.move(); break; - case 14: { + case 6: { int num = 1 + prov.ConsumeIntegralInRange<int>(0, 15); std::vector<int> values(num); for (auto& v : values) { |