]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/detail/canonical_constant/laws.cpp
1 // Copyright Louis Dionne 2013-2016
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/detail/canonical_constant.hpp>
6 #include <boost/hana/tuple.hpp>
8 #include <laws/comparable.hpp>
9 #include <laws/constant.hpp>
10 #include <laws/euclidean_ring.hpp>
11 #include <laws/group.hpp>
12 #include <laws/logical.hpp>
13 #include <laws/monoid.hpp>
14 #include <laws/orderable.hpp>
15 #include <laws/ring.hpp>
16 namespace hana
= boost::hana
;
19 template <typename T
, T v
>
21 static constexpr T value
= v
;
22 using hana_tag
= hana::detail::CanonicalConstant
<T
>;
26 auto ints
= hana::make_tuple(
27 canonical
<int, -10>{}, canonical
<int, -2>{}, canonical
<int, 0>{},
28 canonical
<int, 1>{}, canonical
<int, 3>{}, canonical
<int, 4>{}
31 auto bools
= hana::make_tuple(canonical
<bool, true>{}, canonical
<bool, false>{});
34 hana::test::TestConstant
<hana::detail::CanonicalConstant
<int>>{ints
, hana::tuple_t
<int, long, long long>};
35 hana::test::TestConstant
<hana::detail::CanonicalConstant
<bool>>{bools
, hana::tuple_t
<bool>};
37 // Monoid, Group, Ring, EuclideanRing
38 hana::test::TestMonoid
<hana::detail::CanonicalConstant
<int>>{ints
};
39 hana::test::TestGroup
<hana::detail::CanonicalConstant
<int>>{ints
};
40 hana::test::TestRing
<hana::detail::CanonicalConstant
<int>>{ints
};
41 hana::test::TestEuclideanRing
<hana::detail::CanonicalConstant
<int>>{ints
};
45 auto ints
= hana::make_tuple(
46 canonical
<int, -2>{}, canonical
<int, 0>{},
47 canonical
<int, 1>{}, canonical
<int, 3>{}
49 hana::test::TestLogical
<hana::detail::CanonicalConstant
<int>>{ints
};
50 hana::test::TestLogical
<hana::detail::CanonicalConstant
<bool>>{bools
};
53 // Comparable and Orderable
54 hana::test::TestComparable
<hana::detail::CanonicalConstant
<int>>{ints
};
55 hana::test::TestOrderable
<hana::detail::CanonicalConstant
<int>>{ints
};