equal.cpp 1.2 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright Louis Dionne 2013-2017
  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. #include <boost/hana/assert.hpp>
  5. #include <boost/hana/equal.hpp>
  6. #include <boost/hana/not.hpp>
  7. #include <boost/hana/not_equal.hpp> // for operator !=
  8. #include <boost/hana/optional.hpp>
  9. #include <laws/base.hpp>
  10. namespace hana = boost::hana;
  11. int main() {
  12. hana::test::ct_eq<3> x{};
  13. hana::test::ct_eq<4> y{};
  14. BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::nothing, hana::nothing));
  15. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::nothing, hana::just(x))));
  16. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::just(x), hana::nothing)));
  17. BOOST_HANA_CONSTANT_CHECK(hana::equal(hana::just(x), hana::just(x)));
  18. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::equal(hana::just(x), hana::just(y))));
  19. BOOST_HANA_CONSTANT_CHECK(hana::nothing == hana::nothing);
  20. BOOST_HANA_CONSTANT_CHECK(hana::just(x) == hana::just(x));
  21. BOOST_HANA_CONSTANT_CHECK(hana::just(x) != hana::just(y));
  22. BOOST_HANA_CONSTANT_CHECK(hana::just(x) != hana::nothing);
  23. BOOST_HANA_CONSTANT_CHECK(hana::nothing != hana::just(x));
  24. }