// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include #include #include #include "common.hpp" #include #include #include #include "test_case.hpp" BOOST_METAPARSE_TEST_CASE(one_of) { using boost::metaparse::is_error; using boost::metaparse::one_of; using boost::metaparse::start; using boost::metaparse::get_result; using boost::metaparse::one_char; using boost::metaparse::fail; using boost::metaparse::sequence; using boost::metaparse::get_position; using boost::metaparse::next_char; using boost::mpl::apply_wrap2; using boost::mpl::equal_to; typedef fail test_fail; typedef sequence test_fail_later; // test_1_with_good BOOST_MPL_ASSERT(( equal_to< get_result, str_hello, start> >::type, char_h > )); // test_1_with_bad BOOST_MPL_ASSERT(( is_error, str_hello, start> > )); // test_2_with_two_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_2_with_first_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_2_with_second_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_2_with_two_bad BOOST_MPL_ASSERT(( is_error, str_hello, start> > )); // test BOOST_MPL_ASSERT((is_error, str_hello, start> >)); // test_with_good BOOST_MPL_ASSERT(( equal_to< get_result, str_hello, start> >::type, char_h > )); // test_with_bad BOOST_MPL_ASSERT((is_error,str_hello,start> >)); // test_with_two_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_with_first_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_with_second_good BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_h > )); // test_with_two_bad BOOST_MPL_ASSERT(( is_error, str_hello, start> > )); // test_error_is_the_last_error BOOST_MPL_ASSERT(( equal_to< next_char::type, get_position< apply_wrap2< one_of, str_hello, start > >::type > )); }