// 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 "common.hpp" #include #include #include #include #include #include #include #include #include "test_case.hpp" BOOST_METAPARSE_TEST_CASE(sequence) { using boost::metaparse::get_result; using boost::metaparse::sequence; using boost::metaparse::start; using boost::metaparse::is_error; using boost::metaparse::always; using boost::metaparse::one_char; using boost::mpl::equal; using boost::mpl::apply_wrap2; using boost::mpl::list; using boost::mpl::equal_to; using boost::mpl::at_c; using boost::mpl::vector_c; using boost::mpl::vector; typedef always always_int; // test_no_parser BOOST_MPL_ASSERT(( equal, str_hello, start> >::type, list<> > )); // test_one_parser BOOST_MPL_ASSERT(( equal< get_result, str_hello, start> >::type, vector_c > )); // test_one_failing_parser BOOST_MPL_ASSERT((is_error, str_hello, start> >)); // test_two_chars BOOST_MPL_ASSERT(( equal< get_result, str_hello, start> >::type, vector_c > )); // test_first_fails BOOST_MPL_ASSERT(( is_error, str_hello, start> > )); // test_second_fails BOOST_MPL_ASSERT(( is_error, str_hello, start> > )); // test_empty_input BOOST_MPL_ASSERT((is_error, str_,start> >)); // test_three_chars BOOST_MPL_ASSERT(( equal< get_result< apply_wrap2, str_hello, start> >::type, vector_c > )); // test_indexing_in_result BOOST_MPL_ASSERT(( equal_to< at_c< get_result< apply_wrap2, str_hello, start> >::type, 1 >::type, char_e > )); // test_no_extra_evaluation BOOST_MPL_ASSERT(( equal< get_result< apply_wrap2, str_ca, start> >::type, vector > )); }