Skip to content

Commit

Permalink
test: add variety to tests and added missing include
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperPaul123 committed Jul 3, 2024
1 parent 7125885 commit 3dabd45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/source/thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <random>
#include <string>
#include <thread>
#include <array>

auto multiply(int a, int b) { return a * b; }

Expand Down Expand Up @@ -491,8 +492,8 @@ TEST_CASE("Ensure wait_for_tasks() can be called multiple times on the same pool
for (size_t i = 0; i < task_count; i++) {
counter_wrapper cnt_wrp{};

for (size_t var1 = 0; var1 < 17; var1++) {
for (int var2 = 0; var2 < 12; var2++) {
for (size_t var1 = 0; var1 < 16; var1++) {
for (int var2 = 0; var2 < 13; var2++) {
local_pool.enqueue_detach([&cnt_wrp]() { cnt_wrp.increment_counter(); });
}
}
Expand All @@ -502,9 +503,9 @@ TEST_CASE("Ensure wait_for_tasks() can be called multiple times on the same pool
}

auto all_correct_count =
std::ranges::all_of(counts, [](int count) { return count == 17 * 12; });
std::ranges::all_of(counts, [](int count) { return count == 16 * 13; });
auto sum = std::accumulate(counts.begin(), counts.end(), 0);
CHECK_EQ(sum, 17 * 12 * task_count);
CHECK_EQ(sum, 16 * 13 * task_count);
CHECK(all_correct_count);

for (size_t i = 0; i < task_count; i++) {
Expand Down

0 comments on commit 3dabd45

Please sign in to comment.