diff --git a/meta/tests/pp/foldl.c++ b/meta/tests/pp/foldl.c++ index b971b9d3..8d26dfa5 100644 --- a/meta/tests/pp/foldl.c++ +++ b/meta/tests/pp/foldl.c++ @@ -5,3 +5,6 @@ using namespace std::string_view_literals; static_assert(AW_TO_STR(AW_FOLD_LEFT(AW_IDENTITY, AW_TO_STR, a, b, c)) == R"("a", "b", "c")"sv); + +#define SHOW_ASSOC( a, b ) (a b) +static_assert(AW_TO_STR(AW_FOLDL(SHOW_ASSOC, 1, 2, 3, 4, 5, 6, 7)) == "((((((1 2) 3) 4) 5) 6) 7)"sv); diff --git a/meta/tests/pp/foldr.c++ b/meta/tests/pp/foldr.c++ index 6b775864..05c7fc48 100644 --- a/meta/tests/pp/foldr.c++ +++ b/meta/tests/pp/foldr.c++ @@ -6,3 +6,6 @@ using namespace std::string_view_literals; static_assert(AW_TO_STR(AW_FOLD_RIGHT(AW_IDENTITY, AW_TO_STR, a, b, c)) == R"("a", "b", "c")"sv); static_assert(AW_TO_STR(AW_FOREACH(AW_TO_STR, a, b, c)) == R"("a", "b", "c")"sv); + +#define SHOW_ASSOC( a, b ) (a b) +static_assert(AW_TO_STR(AW_FOLDR(SHOW_ASSOC, 1, 2, 3, 4, 5, 6, 7)) == "(1 (2 (3 (4 (5 (6 7))))))"sv); diff --git a/meta/tests/pp/tuple.c++ b/meta/tests/pp/tuple.c++ index 8dead230..aee38160 100644 --- a/meta/tests/pp/tuple.c++ +++ b/meta/tests/pp/tuple.c++ @@ -11,3 +11,4 @@ static_assert(AW_TO_STR(AW_FIRST( a,b,c )) == "a"sv); static_assert(AW_TO_STR(AW_SECOND( a,b,c )) == "b"sv); static_assert(AW_TO_STR(AW_TAIL( a,b,c )) == "b,c"sv); static_assert(AW_TO_STR(AW_UNPACK( AW_TUPLE(a,b,c) )) == "a,b,c"sv); +static_assert(AW_TO_STR(AW_COMBINE( AW_TUPLE(a,b), AW_TUPLE(c,d)) ) == "(a,b,c,d)"sv); diff --git a/meta/tests/pp/tuple_fold.c++ b/meta/tests/pp/tuple_fold.c++ new file mode 100644 index 00000000..d25ec609 --- /dev/null +++ b/meta/tests/pp/tuple_fold.c++ @@ -0,0 +1,11 @@ +#include +#include +#include + +#include + +using namespace std::string_view_literals; + +static_assert( + AW_TO_STR(AW_FOLD_RIGHT( AW_COMBINE, AW_IDENTITY, (1), (2), (3), (4), (5), (6), (7) )) == + "(1,2,3,4,5,6,7)"sv);