63 lines
1.6 KiB
C++
63 lines
1.6 KiB
C++
#include <catch.hpp>
|
|
#include <alsk/alsk.h>
|
|
|
|
using namespace alsk::edsl;
|
|
|
|
struct Do { void operator()() { std::puts("Do"); } };
|
|
|
|
TEST_CASE("edsl::Farm") {
|
|
auto aDo = makeOperand<Do>();
|
|
|
|
auto e0 = *aDo;
|
|
using E0 = decltype(e0);
|
|
using S0 = alsk::S<alsk::Farm, Do>;
|
|
using L0 = alsk::L<alsk::Farm, void(), void()>;
|
|
|
|
auto e1 = 5*aDo;
|
|
using E1 = decltype(e1);
|
|
using S1 = alsk::S<alsk::Farm, Do>;
|
|
using L1 = alsk::L<alsk::Farm, void(), void()>;
|
|
|
|
auto e2 = aDo*3;
|
|
using E2 = decltype(e2);
|
|
using S2 = alsk::S<alsk::Farm, Do>;
|
|
using L2 = alsk::L<alsk::Farm, void(), void()>;
|
|
|
|
auto e3 = farm(aDo, 3);
|
|
using E3 = decltype(e3);
|
|
using S3 = alsk::S<alsk::Farm, Do>;
|
|
using L3 = alsk::L<alsk::Farm, void(), void()>;
|
|
|
|
SECTION("Construction") {
|
|
REQUIRE(std::is_same<E0::Struct, S0>{});
|
|
REQUIRE(std::is_same<E0::Links, L0>{});
|
|
REQUIRE(std::is_same<E0::Signature, void()>{});
|
|
|
|
REQUIRE(std::is_same<E1::Struct, S1>{});
|
|
REQUIRE(std::is_same<E1::Links, L1>{});
|
|
REQUIRE(std::is_same<E1::Signature, void()>{});
|
|
|
|
REQUIRE(std::is_same<E2::Struct, S2>{});
|
|
REQUIRE(std::is_same<E2::Links, L2>{});
|
|
REQUIRE(std::is_same<E2::Signature, void()>{});
|
|
|
|
REQUIRE(std::is_same<E3::Struct, S3>{});
|
|
REQUIRE(std::is_same<E3::Links, L3>{});
|
|
REQUIRE(std::is_same<E3::Signature, void()>{});
|
|
}
|
|
|
|
SECTION("Setup") {
|
|
auto f0 = implement<alsk::exec::Sequential>(e0);
|
|
REQUIRE(f0.skeleton.n == 0);
|
|
|
|
auto f1 = implement<alsk::exec::Sequential>(e1);
|
|
REQUIRE(f1.skeleton.n == 5);
|
|
|
|
auto f2 = implement<alsk::exec::Sequential>(e2);
|
|
REQUIRE(f2.skeleton.n == 3);
|
|
|
|
auto f3 = implement<alsk::exec::Sequential>(e3);
|
|
REQUIRE(f3.skeleton.n == 3);
|
|
}
|
|
}
|