constant.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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/std/integral_constant.hpp>
  5. #include <boost/hana/tuple.hpp>
  6. #include <boost/hana/value.hpp>
  7. #include <laws/constant.hpp>
  8. #include <type_traits>
  9. namespace hana = boost::hana;
  10. int main() {
  11. // value
  12. static_assert(hana::value(std::integral_constant<int, 0>{}) == 0, "");
  13. static_assert(hana::value(std::integral_constant<int, 1>{}) == 1, "");
  14. static_assert(hana::value(std::integral_constant<int, 3>{}) == 3, "");
  15. // laws
  16. hana::test::TestConstant<hana::ext::std::integral_constant_tag<int>>{
  17. hana::make_tuple(
  18. std::integral_constant<int, -10>{},
  19. std::integral_constant<int, -2>{},
  20. std::integral_constant<int, 0>{},
  21. std::integral_constant<int, 1>{},
  22. std::integral_constant<int, 3>{}
  23. ),
  24. hana::tuple_t<int, long, long long>
  25. };
  26. }