MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Correct_Queue_range

Method Correct_Queue_range

src/test/checkqueue_tests.cpp:159–178  ·  view source on GitHub ↗

This test case checks that the CCheckQueue works properly * with each specified size_t Checks pushed. */

Source from the content-addressed store, hash-verified

157 * with each specified size_t Checks pushed.
158 */
159void CheckQueueTest::Correct_Queue_range(std::vector<size_t> range)
160{
161 auto small_queue = std::make_unique<Correct_Queue>(QUEUE_BATCH_SIZE, SCRIPT_CHECK_THREADS);
162 // Make vChecks here to save on malloc (this test can be slow...)
163 std::vector<FakeCheckCheckCompletion> vChecks;
164 vChecks.reserve(9);
165 for (const size_t i : range) {
166 size_t total = i;
167 FakeCheckCheckCompletion::n_calls = 0;
168 CCheckQueueControl<FakeCheckCheckCompletion> control(*small_queue);
169 while (total) {
170 vChecks.clear();
171 vChecks.resize(std::min<size_t>(total, m_rng.randrange(10)));
172 total -= vChecks.size();
173 control.Add(std::move(vChecks));
174 }
175 BOOST_REQUIRE(!control.Complete().has_value());
176 BOOST_REQUIRE_EQUAL(FakeCheckCheckCompletion::n_calls, i);
177 }
178}
179
180BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, CheckQueueTest)
181

Callers

nothing calls this directly

Calls 7

randrangeMethod · 0.80
reserveMethod · 0.45
clearMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
AddMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected