From 8432906bf9be6f16aafdb23aaed34f1247404329 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 23 Jan 2015 20:32:48 +0100 Subject: Implemented `ListTabulate` in terms of `Iota` and `Map` * added `Square` function to math operations header to facilitate a simple test case * added appropriate test case --- test.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index 173aa19..368cce5 100644 --- a/test.cc +++ b/test.cc @@ -5,12 +5,13 @@ #include "list/cons.h" #include "list/list.h" -#include "list/iota.h" #include "list/operation/reverse.h" #include "list/operation/contains.h" #include "list/operation/higher/fold.h" #include "list/operation/higher/misc.h" #include "list/operation/higher/query.h" +#include "list/generator/iota.h" +#include "list/generator/higher/list_tabulate.h" int main(int, char **) { } @@ -546,3 +547,16 @@ static_assert( >::value, "(iota 5 5 -1) != (list 5 4 3 2 1)" ); + +// list tabulate + +static_assert( + std::is_same< + tav::List, tav::Size<1>, tav::Size<4>, tav::Size<9>>::type, + tav::ListTabulate< + tav::Size<4>, + tav::Square + >::type + >::value, + "(list-tabulate 4 square) != (list 0 1 4 9)" +); -- cgit v1.2.3