laws.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/concept/struct.hpp>
  5. #include <boost/hana/integral_constant.hpp>
  6. #include <boost/hana/tuple.hpp>
  7. #include "minimal_struct.hpp"
  8. #include <laws/base.hpp>
  9. #include <laws/comparable.hpp>
  10. #include <laws/foldable.hpp>
  11. #include <laws/searchable.hpp>
  12. namespace hana = boost::hana;
  13. using hana::test::ct_eq;
  14. int main() {
  15. auto eq0 = hana::make_tuple(obj());
  16. auto eq1 = hana::make_tuple(
  17. obj(ct_eq<0>{}), obj(ct_eq<1>{}), obj(ct_eq<2>{})
  18. );
  19. auto eq2 = hana::make_tuple(
  20. obj(ct_eq<0>{}, ct_eq<0>{}),
  21. obj(ct_eq<0>{}, ct_eq<1>{}),
  22. obj(ct_eq<1>{}, ct_eq<0>{}),
  23. obj(ct_eq<1>{}, ct_eq<1>{}),
  24. obj(ct_eq<0>{}, ct_eq<2>{}),
  25. obj(ct_eq<2>{}, ct_eq<3>{})
  26. );
  27. hana::test::TestComparable<minimal_struct_tag<0>>{eq0};
  28. hana::test::TestComparable<minimal_struct_tag<1>>{eq1};
  29. hana::test::TestComparable<minimal_struct_tag<2>>{eq2};
  30. hana::test::TestFoldable<minimal_struct_tag<0>>{eq0};
  31. hana::test::TestFoldable<minimal_struct_tag<1>>{eq1};
  32. hana::test::TestFoldable<minimal_struct_tag<2>>{eq2};
  33. hana::test::TestSearchable<minimal_struct_tag<0>>{eq0, hana::make_tuple()};
  34. hana::test::TestSearchable<minimal_struct_tag<1>>{eq1, hana::make_tuple(hana::int_c<0>)};
  35. hana::test::TestSearchable<minimal_struct_tag<2>>{eq2, hana::make_tuple(hana::int_c<0>, hana::int_c<1>)};
  36. }