monoid.cpp 847 B

1234567891011121314151617181920212223242526
  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/concept/monoid.hpp>
  6. #include <boost/hana/plus.hpp>
  7. #include <boost/hana/tuple.hpp>
  8. #include <boost/hana/zero.hpp>
  9. #include <laws/monoid.hpp>
  10. namespace hana = boost::hana;
  11. int main() {
  12. hana::test::TestMonoid<int>{hana::make_tuple(0,1,2,3,4,5)};
  13. hana::test::TestMonoid<unsigned int>{hana::make_tuple(0u,1u,2u,3u,4u,5u)};
  14. hana::test::TestMonoid<long>{hana::make_tuple(0l,1l,2l,3l,4l,5l)};
  15. hana::test::TestMonoid<unsigned long>{hana::make_tuple(0ul,1ul,2ul,3ul,4ul,5ul)};
  16. // zero
  17. static_assert(hana::zero<int>() == 0, "");
  18. // plus
  19. static_assert(hana::plus(6, 4) == 6 + 4, "");
  20. }