// Copyright Louis Dionne 2013-2017 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #ifndef BOOST_HANA_TEST_LAWS_HASHABLE_HPP #define BOOST_HANA_TEST_LAWS_HASHABLE_HPP #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace hana { namespace test { template > struct TestHashable : TestHashable { using TestHashable::TestHashable; }; template struct TestHashable { template TestHashable(Xs xs) { hana::for_each(xs, [](auto x) { static_assert(Hashable{}, ""); }); hana::for_each(xs, [&](auto const& x) { hana::for_each(xs, [&](auto const& y) { using X = hana::tag_of_t; using Y = hana::tag_of_t; constexpr bool comparable = !hana::is_default< hana::equal_impl >::value; hana::if_(hana::bool_c, [](auto const& x, auto const& y) { BOOST_HANA_CHECK( hana::equal(x, y) ^implies^ hana::equal(hana::hash(x), hana::hash(y)) ); }, [](auto...) { } )(x, y); }); }); } }; }}} // end namespace boost::hana::test #endif // !BOOST_HANA_TEST_LAWS_HASHABLE_HPP