]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/minimal_product.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)
5 #include <boost/hana/tuple.hpp>
6 #include <boost/hana/first.hpp>
7 #include <boost/hana/second.hpp>
9 #include <laws/base.hpp>
10 #include <laws/comparable.hpp>
11 #include <laws/foldable.hpp>
12 #include <laws/orderable.hpp>
13 #include <laws/product.hpp>
14 #include <support/minimal_product.hpp>
15 #include <support/tracked.hpp>
18 namespace hana
= boost::hana
;
19 using hana::test::ct_eq
;
20 using hana::test::ct_ord
;
24 // Make sure `first` and `second` are "accessors". If they are not,
25 // `Tracked` should report a double-move.
27 auto prod
= ::minimal_product(::Tracked
{1}, ::Tracked
{2});
28 auto fst
= hana::first(std::move(prod
));
29 auto snd
= hana::second(std::move(prod
));
32 //////////////////////////////////////////////////////////////////////////
33 // Comparable, Orderable, Foldable, Product
34 //////////////////////////////////////////////////////////////////////////
35 auto eq_elems
= hana::make_tuple(ct_eq
<3>{}, ct_eq
<4>{});
37 auto eqs
= hana::make_tuple(
38 ::minimal_product(ct_eq
<3>{}, ct_eq
<3>{})
39 , ::minimal_product(ct_eq
<3>{}, ct_eq
<4>{})
40 , ::minimal_product(ct_eq
<4>{}, ct_eq
<3>{})
41 , ::minimal_product(ct_eq
<4>{}, ct_eq
<4>{})
44 auto ords
= hana::make_tuple(
45 ::minimal_product(ct_ord
<3>{}, ct_ord
<3>{})
46 , ::minimal_product(ct_ord
<3>{}, ct_ord
<4>{})
47 , ::minimal_product(ct_ord
<4>{}, ct_ord
<3>{})
48 , ::minimal_product(ct_ord
<4>{}, ct_ord
<4>{})
51 hana::test::TestComparable
<::MinimalProduct
>{eqs
};
52 hana::test::TestOrderable
<::MinimalProduct
>{ords
};
53 hana::test::TestFoldable
<::MinimalProduct
>{eqs
};
54 hana::test::TestProduct
<::MinimalProduct
>{eq_elems
};