commas.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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 <support/cnumeric.hpp>
  6. namespace hana = boost::hana;
  7. // This test makes sure that we can use conditions with multiple comma-separated
  8. // arguments to the non-MSG versions of the BOOST_HANA_XXX_ASSERT macros.
  9. template <bool value, typename ...>
  10. bool runtime_bool() { return value; }
  11. template <bool value, typename ...>
  12. auto constant_bool() { return make_cnumeric<bool, value>(); }
  13. int main() {
  14. BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void>());
  15. BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void, void>());
  16. BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void, void, void>());
  17. BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void>());
  18. BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void, void>());
  19. BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void, void, void>());
  20. BOOST_HANA_ASSERT(runtime_bool<true, void>());
  21. BOOST_HANA_ASSERT(runtime_bool<true, void, void>());
  22. BOOST_HANA_ASSERT(runtime_bool<true, void, void, void>());
  23. BOOST_HANA_ASSERT(constant_bool<true, void>());
  24. BOOST_HANA_ASSERT(constant_bool<true, void, void>());
  25. BOOST_HANA_ASSERT(constant_bool<true, void, void, void>());
  26. }