Enhanced some test descriptions
This commit is contained in:
@@ -4,21 +4,21 @@
|
||||
|
||||
using namespace matador::utils;
|
||||
|
||||
TEST_CASE("thread_pool creates and rejects zero-sized construction") {
|
||||
TEST_CASE("ThreadPool: thread_pool creates and rejects zero-sized construction") {
|
||||
REQUIRE_THROWS(thread_pool(0));
|
||||
|
||||
const thread_pool tp(2);
|
||||
REQUIRE(tp.size() == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("thread_pool schedules and runs simple tasks") {
|
||||
TEST_CASE("ThreadPool: thread_pool schedules and runs simple tasks") {
|
||||
thread_pool pool(3);
|
||||
auto fut = pool.schedule([](cancel_token&, const int x) { return x * 10; }, 7);
|
||||
REQUIRE(fut);
|
||||
REQUIRE(fut.value().get() == 70);
|
||||
}
|
||||
|
||||
TEST_CASE("thread_pool parallel computation and results") {
|
||||
TEST_CASE("ThreadPool: thread_pool parallel computation and results") {
|
||||
thread_pool pool(4);
|
||||
std::vector<std::future<int>> futs;
|
||||
for (int i = 1; i <= 20; ++i) {
|
||||
@@ -33,7 +33,7 @@ TEST_CASE("thread_pool parallel computation and results") {
|
||||
REQUIRE(sum == 230); // (2+3+...+21) = (21*22/2)-(1) = 231-1
|
||||
}
|
||||
|
||||
TEST_CASE("thread_pool rejects scheduling after shutdown") {
|
||||
TEST_CASE("ThreadPool: thread_pool rejects scheduling after shutdown") {
|
||||
thread_pool pool(2);
|
||||
pool.shutdown();
|
||||
auto result = pool.schedule([](cancel_token&) { return 1; });
|
||||
@@ -41,7 +41,7 @@ TEST_CASE("thread_pool rejects scheduling after shutdown") {
|
||||
REQUIRE(result.err().find("shut down") != std::string::npos);
|
||||
}
|
||||
|
||||
TEST_CASE("thread_pool supports cancel_token for not-yet-run task") {
|
||||
TEST_CASE("ThreadPool: thread_pool supports cancel_token for not-yet-run task") {
|
||||
thread_pool pool(1);
|
||||
std::atomic ran{false};
|
||||
|
||||
@@ -73,7 +73,7 @@ TEST_CASE("thread_pool supports cancel_token for not-yet-run task") {
|
||||
// If started before cancel, may be 100 (rare but possible)
|
||||
}
|
||||
|
||||
TEST_CASE("thread_pool: shutdown finishes all running tasks") {
|
||||
TEST_CASE("ThreadPool: thread_pool: shutdown finishes all running tasks") {
|
||||
thread_pool pool(2);
|
||||
std::atomic counter{0};
|
||||
std::vector<std::future<void>> futs;
|
||||
|
||||
Reference in New Issue
Block a user