less.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/greater.hpp>
  6. #include <boost/hana/greater_equal.hpp>
  7. #include <boost/hana/less.hpp>
  8. #include <boost/hana/less_equal.hpp>
  9. #include <boost/hana/not.hpp>
  10. #include <boost/hana/optional.hpp>
  11. #include <laws/base.hpp>
  12. namespace hana = boost::hana;
  13. using hana::test::ct_ord;
  14. struct undefined { };
  15. int main() {
  16. BOOST_HANA_CONSTANT_CHECK(hana::nothing < hana::just(undefined{}));
  17. BOOST_HANA_CONSTANT_CHECK(hana::just(ct_ord<3>{}) < hana::just(ct_ord<4>{}));
  18. BOOST_HANA_CONSTANT_CHECK(hana::just(ct_ord<3>{}) <= hana::just(ct_ord<4>{}));
  19. BOOST_HANA_CONSTANT_CHECK(hana::just(ct_ord<4>{}) > hana::just(ct_ord<3>{}));
  20. BOOST_HANA_CONSTANT_CHECK(hana::just(ct_ord<4>{}) >= hana::just(ct_ord<3>{}));
  21. BOOST_HANA_CONSTANT_CHECK(hana::less(
  22. hana::nothing,
  23. hana::just(undefined{})
  24. ));
  25. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::less(
  26. hana::just(undefined{}),
  27. hana::nothing
  28. )));
  29. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::less(
  30. hana::nothing,
  31. hana::nothing
  32. )));
  33. BOOST_HANA_CONSTANT_CHECK(hana::less(
  34. hana::just(ct_ord<3>{}),
  35. hana::just(ct_ord<4>{})
  36. ));
  37. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::less(
  38. hana::just(ct_ord<3>{}),
  39. hana::just(ct_ord<3>{})
  40. )));
  41. BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::less(
  42. hana::just(ct_ord<4>{}),
  43. hana::just(ct_ord<3>{})
  44. )));
  45. }