alsk/tests/executor/base.cpp
2021-05-10 18:14:13 +02:00

44 lines
924 B
C++

#include <catch.hpp>
#include <alsk/alsk.h>
TEST_CASE("ExecutorBase") {
alsk::exec::ExecutorBase e;
SECTION("Repeatability") {
auto& r = e.repeatability;
auto const& cl = r.coresList;
SECTION("upTo") {
SECTION("disabled") {
r.upTo(0);
REQUIRE(cl.empty());
r.upTo(1);
REQUIRE(cl.empty());
}
SECTION("enabled") {
for(std::size_t k = 10; k < 20; ++k) {
r.upTo(k);
REQUIRE(cl.size() == k-1);
for(std::size_t i = 0; i < cl.size(); ++i)
REQUIRE(cl[i] == 2+i);
for(std::size_t m = 3; m < 10; ++m) {
r.upTo(k, m);
REQUIRE(cl.size() == k-m+1);
for(std::size_t i = 0; i < cl.size(); ++i)
REQUIRE(cl[i] == m+i);
for(std::size_t s = 2; s < 5; ++s) {
r.upTo(k, m, s);
REQUIRE(cl.size() == (k-m+1+s-1)/s);
for(std::size_t i = 0; i < cl.size(); ++i)
REQUIRE(cl[i] == m+i*s);
}
}
}
}
}
}
}