/* @copyright Louis Dionne 2015 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #include #include #include #include #include #include #include using namespace boost::hana; // This test is in its own file to avoid crashing the compiler. template using eq = test::ct_eq; int main() { ////////////////////////////////////////////////////////////////////////// // Setup for the laws below ////////////////////////////////////////////////////////////////////////// auto eq_tuples = make( make() , make(eq<0>{}) , make(eq<0>{}, eq<1>{}) , make(eq<0>{}, eq<1>{}, eq<2>{}, eq<3>{}) , make(eq<0>{}, eq<1>{}, eq<2>{}, eq<3>{}, eq<4>{}, eq<5>{}) ); auto eq_tuples_tuples = make( make() , make(make(eq<0>{})) , make(make(eq<0>{}), make(eq<1>{}, eq<2>{})) , make(make(eq<0>{}), make(eq<1>{}, eq<2>{}), make(eq<3>{}, eq<4>{})) ); ////////////////////////////////////////////////////////////////////////// // Functor ////////////////////////////////////////////////////////////////////////// { test::TestFunctor{eq_tuples}; } ////////////////////////////////////////////////////////////////////////// // Applicative ////////////////////////////////////////////////////////////////////////// { test::TestApplicative{}; } ////////////////////////////////////////////////////////////////////////// // Monad ////////////////////////////////////////////////////////////////////////// { test::TestMonad{eq_tuples, eq_tuples_tuples}; } ////////////////////////////////////////////////////////////////////////// // MonadPlus ////////////////////////////////////////////////////////////////////////// { // prepend { BOOST_HANA_CONSTANT_CHECK(equal( prepend(long_<0>, tuple_c), tuple_c )); BOOST_HANA_CONSTANT_CHECK(equal( prepend(uint<0>, tuple_c), tuple_c )); BOOST_HANA_CONSTANT_CHECK(equal( prepend(llong<0>, tuple_c), tuple_c )); BOOST_HANA_CONSTANT_CHECK(equal( prepend(ulong<0>, tuple_c), tuple_c )); } // empty { BOOST_HANA_CONSTANT_CHECK(equal( empty(), tuple_c )); BOOST_HANA_CONSTANT_CHECK(equal( empty(), tuple_c )); BOOST_HANA_CONSTANT_CHECK(equal( empty(), tuple_c )); } test::TestMonadPlus{eq_tuples}; } }