alsk/tests/edsl/op/while.cpp

24 lines
624 B
C++
Raw Permalink Normal View History

2021-05-10 16:14:13 +00:00
#include <catch.hpp>
#include <alsk/alsk.h>
using namespace alsk::edsl;
struct Pred { int n; bool operator()() { return --n; } };
struct Do { void operator()() { std::puts("Do"); } };
TEST_CASE("edsl::While") {
auto aPred = makeOperand<bool(), Pred>();
auto aDo = makeOperand<Do>();
auto e0 = while_(aPred).do_(aDo);
using E0 = decltype(e0);
using S0 = alsk::S<alsk::While, Pred, Do>;
using L0 = alsk::L<alsk::While, void(), bool(), void()>;
SECTION("Construction") {
REQUIRE(std::is_same<E0::Struct, S0>{});
REQUIRE(std::is_same<E0::Links, L0>{});
REQUIRE(std::is_same<E0::Signature, void()>{});
}
}