merge bitcoin#26272: Prevent UB in minisketch_tests.cpp

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-19 12:53:12 +00:00
parent 0cf7401173
commit 477157d40b
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(minisketch_test)
Minisketch sketch_c = std::move(sketch_ar); Minisketch sketch_c = std::move(sketch_ar);
sketch_c.Merge(sketch_br); sketch_c.Merge(sketch_br);
auto dec = sketch_c.Decode(errors); auto dec = sketch_c.Decode(errors);
BOOST_CHECK(dec.has_value()); BOOST_REQUIRE(dec.has_value());
auto sols = std::move(*dec); auto sols = std::move(*dec);
std::sort(sols.begin(), sols.end()); std::sort(sols.begin(), sols.end());
for (uint32_t i = 0; i < a_not_b; ++i) BOOST_CHECK_EQUAL(sols[i], start_a + i); for (uint32_t i = 0; i < a_not_b; ++i) BOOST_CHECK_EQUAL(sols[i], start_a + i);