refactor: Make move semantics explicit for callers

This commit is contained in:
Hennadii Stepanov
2023-03-21 13:04:01 +00:00
parent 6c2d5972f3
commit 04831fee6d
6 changed files with 16 additions and 15 deletions

View File

@@ -191,7 +191,7 @@ static void Correct_Queue_range(std::vector<size_t> range)
while (total) {
vChecks.resize(std::min(total, (size_t) InsecureRandRange(10)));
total -= vChecks.size();
control.Add(vChecks);
control.Add(std::move(vChecks));
}
BOOST_REQUIRE(control.Wait());
if (FakeCheckCheckCompletion::n_calls != i) {
@@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Catches_Failure)
vChecks.reserve(r);
for (size_t k = 0; k < r && remaining; k++, remaining--)
vChecks.emplace_back(remaining == 1);
control.Add(vChecks);
control.Add(std::move(vChecks));
}
bool success = control.Wait();
if (i > 0) {
@@ -278,7 +278,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Recovers_From_Failure)
std::vector<FailingCheck> vChecks;
vChecks.resize(100, false);
vChecks[99] = end_fails;
control.Add(vChecks);
control.Add(std::move(vChecks));
}
bool r =control.Wait();
BOOST_REQUIRE(r != end_fails);
@@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_UniqueCheck)
std::vector<UniqueCheck> vChecks;
for (size_t k = 0; k < r && total; k++)
vChecks.emplace_back(--total);
control.Add(vChecks);
control.Add(std::move(vChecks));
}
}
{
@@ -342,7 +342,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory)
// to catch any sort of deallocation failure
vChecks.emplace_back(total == 0 || total == i || total == i/2);
}
control.Add(vChecks);
control.Add(std::move(vChecks));
}
}
BOOST_REQUIRE_EQUAL(MemoryCheck::fake_allocated_memory, 0U);
@@ -364,7 +364,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
// swaps in default initialized Checks (otherwise freezing destructor
// would get called twice).
vChecks[0].should_freeze = true;
control.Add(vChecks);
control.Add(std::move(vChecks));
bool waitResult = control.Wait(); // Hangs here
assert(waitResult);
});