| 1 | // Copyright Louis Dionne 2013-2022 |
| 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/assert.hpp> |
| 6 | #include <boost/hana/equal.hpp> |
| 7 | #include <boost/hana/experimental/view.hpp> |
| 8 | #include <boost/hana/unpack.hpp> |
| 9 | |
| 10 | #include <laws/base.hpp> |
| 11 | #include <support/seq.hpp> |
| 12 | namespace hana = boost::hana; |
| 13 | using hana::test::ct_eq; |
| 14 | |
| 15 | |
| 16 | int main() { |
| 17 | auto f = hana::test::_injection<0>{}; |
| 18 | auto g = hana::test::_injection<1>{}; |
| 19 | auto check = [=](auto ...x) { |
| 20 | auto storage = ::seq(x...); |
| 21 | auto transformed = hana::experimental::transformed(storage, f); |
| 22 | |
| 23 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 24 | hana::unpack(transformed, g), |
| 25 | g(f(x)...) |
| 26 | )); |
| 27 | }; |
| 28 | |
| 29 | check(); |
| 30 | check(ct_eq<0>{}); |
| 31 | check(ct_eq<0>{}, ct_eq<1>{}); |
| 32 | check(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}); |
| 33 | check(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{}); |
| 34 | } |
| 35 | |