Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / searchable.cpp
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/bool.hpp>
6 #include <boost/hana/core/make.hpp>
7 #include <boost/hana/tuple.hpp>
8
9 #include <support/seq.hpp>
10
11 #include <laws/base.hpp>
12 #include <laws/searchable.hpp>
13 namespace hana = boost::hana;
14 using hana::test::ct_eq;
15
16
17 int main() {
18     //////////////////////////////////////////////////////////////////////////
19     // Laws with a minimal Searchable
20     //////////////////////////////////////////////////////////////////////////
21     {
22         auto eqs = hana::make_tuple(
23               ::seq()
24             , ::seq(ct_eq<0>{})
25             , ::seq(ct_eq<0>{}, ct_eq<1>{})
26             , ::seq(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
27             , ::seq(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
28         );
29
30         auto eq_keys = hana::make_tuple(ct_eq<0>{}, ct_eq<3>{}, ct_eq<10>{});
31
32         hana::test::TestSearchable<::Seq>{eqs, eq_keys};
33
34         auto bools = hana::make_tuple(
35               ::seq(hana::true_c)
36             , ::seq(hana::false_c)
37             , ::seq(hana::true_c, hana::true_c)
38             , ::seq(hana::true_c, hana::false_c)
39             , ::seq(hana::false_c, hana::true_c)
40             , ::seq(hana::false_c, hana::false_c)
41         );
42         hana::test::TestSearchable<::Seq>{bools, hana::make_tuple(hana::true_c, hana::false_c)};
43     }
44 }