From 1d7023c368d68a983faaee4c22fa6700a89393f8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 22 Jan 2015 18:27:20 +0100 Subject: Implemented Scheme like `Concatenate` in terms of `Fold` and `Append` * added appropriate test case --- test.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index e8e87e1..b945899 100644 --- a/test.cc +++ b/test.cc @@ -317,7 +317,7 @@ static_assert( "(length (take 3 (list 1 2))) != 2" ); -// list concatenate +// list append static_assert( std::is_same< @@ -329,7 +329,7 @@ static_assert( >::type >::type >::value, - "(length (concatenate (list 1) (list 2))) != 2" + "(length (append (list 1) (list 2))) != 2" ); static_assert( @@ -342,7 +342,7 @@ static_assert( >::type >::type >::value, - "(length (concatenate (list 1 2) (list 3 4))) != 4" + "(length (append (list 1 2) (list 3 4))) != 4" ); // list fold @@ -491,3 +491,19 @@ static_assert( >::value, "(contains 0 (list 1 2 3)) != #f" ); + +// list concatenate + +static_assert( + std::is_same< + tav::List, tav::Int<2>, tav::Int<3>, tav::Int<4>, tav::Int<5>, tav::Int<6>>::type, + tav::Concatenate< + tav::List< + tav::List, tav::Int<2>>::type, + tav::List>::type, + tav::List, tav::Int<5>, tav::Int<6>>::type + >::type + >::type + >::value, + "(length (concatenate (list (list 1 2) (list 3) (list 4 5 6)))) != 6" +); -- cgit v1.2.3