mirror of
https://github.com/BlackMATov/kari.hpp.git
synced 2025-12-15 13:29:49 +07:00
fix msvc 2017 tests compilation
This commit is contained in:
@@ -84,10 +84,12 @@ TEST_CASE("kari_examples") {
|
|||||||
SUBCASE("API/is_curried") {
|
SUBCASE("API/is_curried") {
|
||||||
using namespace kari_hpp;
|
using namespace kari_hpp;
|
||||||
|
|
||||||
constexpr curry_t c = [](int a, int b){
|
constexpr auto l = [](int a, int b){
|
||||||
return a + b;
|
return a + b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr curry_t c = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(is_curried_v<decltype(c)>);
|
STATIC_REQUIRE(is_curried_v<decltype(c)>);
|
||||||
STATIC_REQUIRE(is_curried<decltype(c)>::value);
|
STATIC_REQUIRE(is_curried<decltype(c)>::value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,25 +14,31 @@ using namespace kari_hpp;
|
|||||||
TEST_CASE("kari") {
|
TEST_CASE("kari") {
|
||||||
SUBCASE("ctor") {
|
SUBCASE("ctor") {
|
||||||
{
|
{
|
||||||
constexpr curry_t f = [](){
|
constexpr auto l = [](){
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f() == 1);
|
STATIC_REQUIRE(f() == 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
constexpr curry_t f = [](auto a){
|
constexpr auto l = [](auto a){
|
||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f(1) == 1);
|
STATIC_REQUIRE(f(1) == 1);
|
||||||
STATIC_REQUIRE(f()(1) == 1);
|
STATIC_REQUIRE(f()(1) == 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
constexpr curry_t f = [](auto a, auto b){
|
constexpr auto l = [](auto a, auto b){
|
||||||
return a + b;
|
return a + b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f(1,2) == 3);
|
STATIC_REQUIRE(f(1,2) == 3);
|
||||||
STATIC_REQUIRE(f()(1,2) == 3);
|
STATIC_REQUIRE(f()(1,2) == 3);
|
||||||
|
|
||||||
@@ -42,10 +48,12 @@ TEST_CASE("kari") {
|
|||||||
STATIC_REQUIRE(f()(1)()(2) == 3);
|
STATIC_REQUIRE(f()(1)()(2) == 3);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
constexpr curry_t f = [](auto a, auto b, auto c){
|
constexpr auto l = [](auto a, auto b, auto c){
|
||||||
return a + b + c;
|
return a + b + c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f(1,2,3) == 6);
|
STATIC_REQUIRE(f(1,2,3) == 6);
|
||||||
STATIC_REQUIRE(f()(1,2,3) == 6);
|
STATIC_REQUIRE(f()(1,2,3) == 6);
|
||||||
|
|
||||||
@@ -71,11 +79,13 @@ TEST_CASE("kari") {
|
|||||||
|
|
||||||
SUBCASE("nested ctor") {
|
SUBCASE("nested ctor") {
|
||||||
{
|
{
|
||||||
constexpr auto f = curry_t([](auto a){
|
constexpr auto l = [](auto a){
|
||||||
return curry_t([a](auto b, auto c){
|
return curry_t([a](auto b, auto c){
|
||||||
return a + b + c;
|
return a + b + c;
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f(1,2,3) == 6);
|
STATIC_REQUIRE(f(1,2,3) == 6);
|
||||||
STATIC_REQUIRE(f()(1,2,3) == 6);
|
STATIC_REQUIRE(f()(1,2,3) == 6);
|
||||||
@@ -99,11 +109,13 @@ TEST_CASE("kari") {
|
|||||||
STATIC_REQUIRE(f()(1)()(2)()(3) == 6);
|
STATIC_REQUIRE(f()(1)()(2)()(3) == 6);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
constexpr auto f = curry_t([](auto a, auto b){
|
constexpr auto l = [](auto a, auto b){
|
||||||
return curry_t([a, b](auto c){
|
return curry_t([a, b](auto c){
|
||||||
return a + b + c;
|
return a + b + c;
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
|
constexpr curry_t f = l;
|
||||||
|
|
||||||
STATIC_REQUIRE(f(1,2,3) == 6);
|
STATIC_REQUIRE(f(1,2,3) == 6);
|
||||||
STATIC_REQUIRE(f()(1,2,3) == 6);
|
STATIC_REQUIRE(f()(1,2,3) == 6);
|
||||||
|
|||||||
Reference in New Issue
Block a user