feat add no args task test
Some checks failed
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 57s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m2s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m6s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m13s
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m23s
linux-x64-gcc / linux-gcc (push) Successful in 1m31s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Failing after 56s
Some checks failed
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 57s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m2s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m6s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m13s
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m23s
linux-x64-gcc / linux-gcc (push) Successful in 1m31s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Failing after 56s
This commit is contained in:
parent
59e5b6644a
commit
c6a2dbac8d
@ -4,7 +4,10 @@
|
|||||||
|
|
||||||
class ThreadPoolTest : public ::testing::Test {
|
class ThreadPoolTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override { thread_pool_ = std::make_unique<ulib::ThreadPool>(10); }
|
void SetUp() override
|
||||||
|
{
|
||||||
|
thread_pool_ = std::make_unique<ulib::ThreadPool>(10);
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<ulib::ThreadPool> thread_pool_;
|
std::unique_ptr<ulib::ThreadPool> thread_pool_;
|
||||||
};
|
};
|
||||||
@ -32,3 +35,15 @@ TEST_F(ThreadPoolTest, MultiTask)
|
|||||||
|
|
||||||
for (auto &future : futures) { ASSERT_EQ(future.get(), 3); }
|
for (auto &future : futures) { ASSERT_EQ(future.get(), 3); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ThreadPoolTest, NoArgs)
|
||||||
|
{
|
||||||
|
std::vector<std::future<int>> futures;
|
||||||
|
for (int i = 0; i < 1000; ++i) {
|
||||||
|
futures.emplace_back(thread_pool_->Submit([]() {
|
||||||
|
ulib::Thread::Sleep(1000);
|
||||||
|
return 1;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
for (auto &future : futures) { future.get(); }
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user