fix msvc 2017 tests compilation

This commit is contained in:
BlackMATov
2020-12-11 11:08:52 +07:00
parent 54d9db7138
commit 6b6f2e7914
2 changed files with 23 additions and 9 deletions

View File

@@ -84,10 +84,12 @@ TEST_CASE("kari_examples") {
SUBCASE("API/is_curried") {
using namespace kari_hpp;
constexpr curry_t c = [](int a, int b){
constexpr auto l = [](int a, int b){
return a + b;
};
constexpr curry_t c = l;
STATIC_REQUIRE(is_curried_v<decltype(c)>);
STATIC_REQUIRE(is_curried<decltype(c)>::value);
}

View File

@@ -14,25 +14,31 @@ using namespace kari_hpp;
TEST_CASE("kari") {
SUBCASE("ctor") {
{
constexpr curry_t f = [](){
constexpr auto l = [](){
return 1;
};
constexpr curry_t f = l;
STATIC_REQUIRE(f() == 1);
}
{
constexpr curry_t f = [](auto a){
constexpr auto l = [](auto a){
return a;
};
constexpr curry_t f = l;
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;
};
constexpr curry_t f = l;
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);
}
{
constexpr curry_t f = [](auto a, auto b, auto c){
constexpr auto l = [](auto a, auto b, auto c){
return a + b + c;
};
constexpr curry_t f = l;
STATIC_REQUIRE(f(1,2,3) == 6);
STATIC_REQUIRE(f()(1,2,3) == 6);
@@ -71,11 +79,13 @@ TEST_CASE("kari") {
SUBCASE("nested ctor") {
{
constexpr auto f = curry_t([](auto a){
constexpr auto l = [](auto a){
return curry_t([a](auto b, auto c){
return a + b + c;
});
});
};
constexpr curry_t f = l;
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);
}
{
constexpr auto f = curry_t([](auto a, auto b){
constexpr auto l = [](auto a, auto b){
return curry_t([a, b](auto c){
return a + b + c;
});
});
};
constexpr curry_t f = l;
STATIC_REQUIRE(f(1,2,3) == 6);
STATIC_REQUIRE(f()(1,2,3) == 6);