Changeset View
Changeset View
Standalone View
Standalone View
src/test/scheduler_tests.cpp
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(manythreads) { | ||||
int counter[10] = {0}; | int counter[10] = {0}; | ||||
FastRandomContext rng{/* fDeterministic */ true}; | FastRandomContext rng{/* fDeterministic */ true}; | ||||
// [0, 9] | // [0, 9] | ||||
auto zeroToNine = [](FastRandomContext &rc) -> int { | auto zeroToNine = [](FastRandomContext &rc) -> int { | ||||
return rc.randrange(10); | return rc.randrange(10); | ||||
}; | }; | ||||
// [-11, 1000] | // [-11, 1000] | ||||
auto randomMsec = [](FastRandomContext &rc) -> int { | auto randomMsec = [](FastRandomContext &rc) -> int { | ||||
return -11 + rc.randrange(1012); | return -11 + int(rc.randrange(1012)); | ||||
}; | }; | ||||
// [-1000, 1000] | // [-1000, 1000] | ||||
auto randomDelta = [](FastRandomContext &rc) -> int { | auto randomDelta = [](FastRandomContext &rc) -> int { | ||||
return -1000 + rc.randrange(2001); | return -1000 + int(rc.randrange(2001)); | ||||
}; | }; | ||||
boost::chrono::system_clock::time_point start = | boost::chrono::system_clock::time_point start = | ||||
boost::chrono::system_clock::now(); | boost::chrono::system_clock::now(); | ||||
boost::chrono::system_clock::time_point now = start; | boost::chrono::system_clock::time_point now = start; | ||||
boost::chrono::system_clock::time_point first, last; | boost::chrono::system_clock::time_point first, last; | ||||
size_t nTasks = microTasks.getQueueInfo(first, last); | size_t nTasks = microTasks.getQueueInfo(first, last); | ||||
BOOST_CHECK(nTasks == 0); | BOOST_CHECK(nTasks == 0); | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |