in_range_c.cpp 956 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/metaparse/util/in_range_c.hpp>
  6. #include "common.hpp"
  7. #include <boost/mpl/apply_wrap.hpp>
  8. #include <boost/mpl/not.hpp>
  9. #include <boost/mpl/assert.hpp>
  10. #include "test_case.hpp"
  11. BOOST_METAPARSE_TEST_CASE(util_in_range_c)
  12. {
  13. using boost::metaparse::util::in_range_c;
  14. using boost::mpl::apply_wrap1;
  15. using boost::mpl::not_;
  16. // test_int_in_range
  17. BOOST_MPL_ASSERT((apply_wrap1<in_range_c<char, 'a', 'g'>, char_e>));
  18. // test_lower_bound
  19. BOOST_MPL_ASSERT((apply_wrap1<in_range_c<char, 'a', 'g'>, char_a>));
  20. // test_upper_bound
  21. BOOST_MPL_ASSERT((apply_wrap1<in_range_c<int, 10, 13>, int13>));
  22. // test_int_not_in_range
  23. BOOST_MPL_ASSERT((not_<apply_wrap1<in_range_c<int, 10, 13>, int14> >));
  24. }