From f0ad61d725614302d3d9a61735a7298b49fbcb7a Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 28 Dec 2024 15:23:50 +0800 Subject: [PATCH] test: add group parallel --- src/core_test/cases/ranges.cc | 1 + src/core_test/helper/internal/parallel.cc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core_test/cases/ranges.cc b/src/core_test/cases/ranges.cc index 5b29abf..f9af6be 100644 --- a/src/core_test/cases/ranges.cc +++ b/src/core_test/cases/ranges.cc @@ -20,6 +20,7 @@ using klotski::cases::BASIC_RANGES_NUM_; constexpr auto Heads = RangesUnion::Heads; +static_assert(std::is_default_constructible_v); // TODO: more concept assert static_assert(std::is_base_of_v, Ranges>); TEST(Ranges, check) { diff --git a/src/core_test/helper/internal/parallel.cc b/src/core_test/helper/internal/parallel.cc index a4ef4ee..49774f6 100644 --- a/src/core_test/helper/internal/parallel.cc +++ b/src/core_test/helper/internal/parallel.cc @@ -32,7 +32,15 @@ void helper::block_num_parallel(std::function } void helper::group_parallel(std::function &&func) { - // TODO: spawn all Groups + BS::thread_pool pool; + for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { + for (auto group : GroupUnion::unsafe_create(type_id).groups()) { + pool.detach_task([group, &func] { + func(group); + }); + } + } + pool.wait(); } void helper::type_id_parallel(std::function &&func) {