]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/ext/boost/mpl/list/foldable.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / ext / boost / mpl / list / foldable.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/ext/boost/mpl/list.hpp>
6
7#include <boost/hana/assert.hpp>
8#include <boost/hana/equal.hpp>
9#include <boost/hana/unpack.hpp>
10#include <boost/hana/type.hpp>
11
12#include <laws/base.hpp>
13#include <laws/foldable.hpp>
14
15#include <boost/mpl/list.hpp>
16namespace hana = boost::hana;
17namespace mpl = boost::mpl;
18
19
20struct t1; struct t2; struct t3; struct t4;
21
22int main() {
23 // unpack
24 {
25 hana::test::_injection<0> f{};
26 BOOST_HANA_CONSTANT_CHECK(hana::equal(
27 hana::unpack(mpl::list<>{}, f),
28 f()
29 ));
30
31 BOOST_HANA_CONSTANT_CHECK(hana::equal(
32 hana::unpack(mpl::list<t1>{}, f),
33 f(hana::type_c<t1>)
34 ));
35
36 BOOST_HANA_CONSTANT_CHECK(hana::equal(
37 hana::unpack(mpl::list<t1, t2>{}, f),
38 f(hana::type_c<t1>, hana::type_c<t2>)
39 ));
40
41 BOOST_HANA_CONSTANT_CHECK(hana::equal(
42 hana::unpack(mpl::list<t1, t2, t3>{}, f),
43 f(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>)
44 ));
45 }
46
47 // laws
48 auto lists = hana::make_tuple(
49 mpl::list<>{}
50 , mpl::list<t1>{}
51 , mpl::list<t1, t2>{}
52 , mpl::list<t1, t2, t3>{}
53 , mpl::list<t1, t2, t3, t4>{}
54 );
55
56 hana::test::TestFoldable<hana::ext::boost::mpl::list_tag>{lists};
57}