orderable.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/ext/boost/tuple.hpp>
  5. #include <boost/hana/tuple.hpp>
  6. #include <laws/comparable.hpp>
  7. #include <laws/orderable.hpp>
  8. #include <boost/tuple/tuple.hpp>
  9. namespace hana = boost::hana;
  10. template <int i>
  11. using eq = hana::test::ct_eq<i>;
  12. template <int i>
  13. using ord = hana::test::ct_ord<i>;
  14. int main() {
  15. //////////////////////////////////////////////////////////////////////////
  16. // Setup for the laws below
  17. //////////////////////////////////////////////////////////////////////////
  18. auto eq_tuples = hana::make_tuple(
  19. ::boost::make_tuple()
  20. , ::boost::make_tuple(eq<0>{})
  21. , ::boost::make_tuple(eq<0>{}, eq<1>{})
  22. , ::boost::make_tuple(eq<0>{}, eq<1>{}, eq<2>{})
  23. , ::boost::make_tuple(eq<0>{}, eq<1>{}, eq<2>{}, eq<3>{}, eq<4>{})
  24. );
  25. auto ord_tuples = hana::make_tuple(
  26. ::boost::make_tuple()
  27. , ::boost::make_tuple(ord<0>{})
  28. , ::boost::make_tuple(ord<0>{}, ord<1>{})
  29. , ::boost::make_tuple(ord<0>{}, ord<1>{}, ord<2>{})
  30. , ::boost::make_tuple(ord<0>{}, ord<1>{}, ord<2>{}, ord<3>{}, ord<4>{})
  31. );
  32. //////////////////////////////////////////////////////////////////////////
  33. // Comparable and Orderable
  34. //////////////////////////////////////////////////////////////////////////
  35. hana::test::TestComparable<hana::ext::boost::tuple_tag>{eq_tuples};
  36. hana::test::TestOrderable<hana::ext::boost::tuple_tag>{ord_tuples};
  37. }