Commit ee8414cf by FritzFlorian

Add test for scan.

parent ce936ae6
......@@ -43,3 +43,21 @@ TEST_CASE("for_each functions correctly", "[algorithms/for_each.h]") {
}
});
}
TEST_CASE("scan functions correctly", "[algorithms/scan.h]") {
malloc_scheduler_memory my_scheduler_memory{8, 2 << 12};
scheduler my_scheduler{&my_scheduler_memory, 2};
my_scheduler.perform_work([]() {
constexpr int SIZE = 1000;
std::array<int, SIZE> input_array{}, result_array{};
input_array.fill(1);
pls::scan(input_array.begin(), input_array.end(), result_array.begin(), std::plus<int>(), 0);
bool all_correct = true;
for (int i = 0; i < SIZE; i++) {
all_correct &= result_array[i] == (i + 1);
}
REQUIRE (all_correct);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment