aboutsummaryrefslogtreecommitdiff
path: root/test.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-01-31 12:04:34 +0100
committerAdrian Kummerlaender2015-01-31 12:04:34 +0100
commita9ec2e4e13670c8084c6baae59d6f3631960e22c (patch)
tree5d8b519fc516ac7d8c1baff594a8967b71202fdc /test.cc
parent6291f3ce10aa8ebffa895f21c4ccb91b7349c66a (diff)
downloadTypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar.gz
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar.bz2
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar.lz
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar.xz
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.tar.zst
TypeAsValue-a9ec2e4e13670c8084c6baae59d6f3631960e22c.zip
Implemented higher order `Find` list search operation
* added appropriate test case * other queries in `query.h` may be redefined in terms of `Find`
Diffstat (limited to 'test.cc')
-rw-r--r--test.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/test.cc b/test.cc
index 9168038..014a974 100644
--- a/test.cc
+++ b/test.cc
@@ -11,6 +11,7 @@
#include "list/operation/higher/filter.h"
#include "list/operation/higher/partition.h"
#include "list/operation/higher/query.h"
+#include "list/operation/higher/find.h"
#include "list/generator/iota.h"
#include "list/generator/make_list.h"
#include "list/generator/higher/list_tabulate.h"
@@ -682,6 +683,41 @@ static_assert(
"(count even? (list 1 3 5)) != 0"
);
+//list find
+
+static_assert(
+ std::is_same<
+ tav::Int<4>,
+ tav::Find<
+ tav::Even,
+ tav::List<tav::Int<1>, tav::Int<3>, tav::Int<4>, tav::Int<6>>::type
+ >::type
+ >::value,
+ "(find even? (list 1 3 4 6)) != 4"
+);
+
+static_assert(
+ std::is_same<
+ tav::Int<6>,
+ tav::Find<
+ tav::Even,
+ tav::List<tav::Int<1>, tav::Int<3>, tav::Int<5>, tav::Int<6>>::type
+ >::type
+ >::value,
+ "(find even? (list 1 3 5 6)) != 6"
+);
+
+static_assert(
+ std::is_same<
+ tav::Boolean<false>,
+ tav::Find<
+ tav::Even,
+ tav::List<tav::Int<1>, tav::Int<3>, tav::Int<5>>::type
+ >::type
+ >::value,
+ "(find even? (list 1 3 5)) != #f"
+);
+
// function apply
static_assert(