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 #ifndef BOOST_HANA_TEST_LAWS_PRODUCT_HPP
6 #define BOOST_HANA_TEST_LAWS_PRODUCT_HPP
8 #include <boost/hana/assert.hpp>
9 #include <boost/hana/concept/product.hpp>
10 #include <boost/hana/core/make.hpp>
11 #include <boost/hana/core/when.hpp>
12 #include <boost/hana/equal.hpp>
13 #include <boost/hana/first.hpp>
14 #include <boost/hana/second.hpp>
16 #include <laws/base.hpp>
19 namespace boost { namespace hana { namespace test {
20 template <typename P, typename = when<true>>
21 struct TestProduct : TestProduct<P, laws> {
22 using TestProduct<P, laws>::TestProduct;
26 struct TestProduct<P, laws> {
27 template <typename Elements>
28 TestProduct(Elements elements) {
29 foreach2(elements, [](auto x, auto y) {
30 static_assert(Product<decltype(hana::make<P>(x, y))>::value, "");
32 BOOST_HANA_CHECK(hana::equal(
33 hana::first(hana::make<P>(x, y)),
37 BOOST_HANA_CHECK(hana::equal(
38 hana::second(hana::make<P>(x, y)),
44 }}} // end namespace boost::hana::test
46 #endif // !BOOST_HANA_TEST_LAWS_PRODUCT_HPP