pfor/tests/expression/traits.cpp

34 lines
1.2 KiB
C++
Raw Normal View History

2021-05-10 16:11:23 +00:00
#include <catch.hpp>
#include "../common.h"
#include <pfor/expression/traits.h>
TEST_CASE("Expression/Traits") {
struct E { using IsExpression = pfor::expr::tag::Expression; } e;
struct F {} f;
SECTION("IsExpression") {
REQUIRE(pfor::expr::IsExpression<E>::value);
REQUIRE_FALSE(pfor::expr::IsExpression<F>::value);
REQUIRE(pfor::expr::IsExpression<decltype(e)>::value);
REQUIRE_FALSE(pfor::expr::IsExpression<decltype(f)>::value);
}
SECTION("AllExpression") {
TEST(REQUIRE, pfor::expr::AllExpression<E, E, E, E>::value);
TEST(REQUIRE_FALSE, pfor::expr::AllExpression<E, E, F, E>::value);
TEST(REQUIRE_FALSE, pfor::expr::AllExpression<E, F, F, E>::value);
TEST(REQUIRE_FALSE, pfor::expr::AllExpression<F, F, F, E>::value);
TEST(REQUIRE_FALSE, pfor::expr::AllExpression<F, F, F, F>::value);
}
SECTION("AnyExpression") {
TEST(REQUIRE, pfor::expr::AnyExpression<E, E, E, E>::value);
TEST(REQUIRE, pfor::expr::AnyExpression<E, E, F, E>::value);
TEST(REQUIRE, pfor::expr::AnyExpression<E, F, F, E>::value);
TEST(REQUIRE, pfor::expr::AnyExpression<F, F, F, E>::value);
TEST(REQUIRE_FALSE, pfor::expr::AnyExpression<F, F, F, F>::value);
}
}