searchable.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/bool.hpp>
  5. #include <boost/hana/core/make.hpp>
  6. #include <boost/hana/tuple.hpp>
  7. #include <support/seq.hpp>
  8. #include <laws/base.hpp>
  9. #include <laws/searchable.hpp>
  10. namespace hana = boost::hana;
  11. using hana::test::ct_eq;
  12. int main() {
  13. //////////////////////////////////////////////////////////////////////////
  14. // Laws with a minimal Searchable
  15. //////////////////////////////////////////////////////////////////////////
  16. {
  17. auto eqs = hana::make_tuple(
  18. ::seq()
  19. , ::seq(ct_eq<0>{})
  20. , ::seq(ct_eq<0>{}, ct_eq<1>{})
  21. , ::seq(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{})
  22. , ::seq(ct_eq<0>{}, ct_eq<1>{}, ct_eq<2>{}, ct_eq<3>{})
  23. );
  24. auto eq_keys = hana::make_tuple(ct_eq<0>{}, ct_eq<3>{}, ct_eq<10>{});
  25. hana::test::TestSearchable<::Seq>{eqs, eq_keys};
  26. auto bools = hana::make_tuple(
  27. ::seq(hana::true_c)
  28. , ::seq(hana::false_c)
  29. , ::seq(hana::true_c, hana::true_c)
  30. , ::seq(hana::true_c, hana::false_c)
  31. , ::seq(hana::false_c, hana::true_c)
  32. , ::seq(hana::false_c, hana::false_c)
  33. );
  34. hana::test::TestSearchable<::Seq>{bools, hana::make_tuple(hana::true_c, hana::false_c)};
  35. }
  36. }