MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/base/base_tests/thread_pool_computational_tests.cpp:16–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14} // namespace
15
16UNIT_TEST(ThreadPoolComputational_SomeThreads)
17{
18 for (size_t t = 0; t < kTimes; ++t)
19 {
20 size_t const threadCount = 4;
21 std::atomic<size_t> counter{0};
22 {
23 base::ComputationalThreadPool threadPool(threadCount);
24 for (size_t i = 0; i < threadCount; ++i)
25 {
26 threadPool.Submit([&]()
27 {
28 threads::Sleep(1);
29 ++counter;
30 });
31 }
32 }
33
34 TEST_EQUAL(threadCount, counter, ());
35 }
36}
37
38UNIT_TEST(ThreadPoolComputational_OneThread)
39{

Callers

nothing calls this directly

Calls 4

SleepFunction · 0.85
SubmitMethod · 0.80
getMethod · 0.65
push_backMethod · 0.45

Tested by

no test coverage detected