File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import CppUtils;
66export namespace CppUtils::UnitTest::Thread::ThreadPool
77{
88 inline auto _ = CppUtils::UnitTest::TestSuite{"Thread/ThreadPool", {"UnitTest"}, [](auto& suite) {
9+ using namespace std::chrono_literals;
910 using Logger = CppUtils::Logger<"CppUtils">;
1011
1112 suite.addTest("0 task / 1 thread", [&] {
@@ -40,6 +41,19 @@ export namespace CppUtils::UnitTest::Thread::ThreadPool
4041 called = true;
4142 });
4243 }
44+ std::this_thread::sleep_for(50ms);
45+ suite.expect(called);
46+ });
47+
48+ suite.addTest("waitUntilFinished", [&] {
49+ auto called = std::atomic_bool{false};
50+ {
51+ auto threadPool = CppUtils::Thread::ThreadPool{};
52+ threadPool.call([&called] {
53+ called = true;
54+ });
55+ threadPool.waitUntilFinished();
56+ }
4357 suite.expect(called);
4458 });
4559
You can’t perform that action at this time.
0 commit comments