// 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 "common.hpp" #include #include #include #include #include "test_case.hpp" namespace { using boost::metaparse::keyword; using boost::mpl::list_c; typedef list_c str_hello_world; typedef list_c str_hellx; typedef list_c str_hxllo; typedef keyword keyword_hello; } BOOST_METAPARSE_TEST_CASE(keyword) { using boost::metaparse::get_result; using boost::metaparse::start; using boost::metaparse::is_error; using boost::metaparse::get_remaining; using boost::mpl::equal_to; using boost::mpl::apply_wrap2; using boost::mpl::equal; // test_result_type BOOST_MPL_ASSERT(( equal_to< get_result< apply_wrap2, str_hello, start> >::type, char_l > )); // test_empty_keyword BOOST_MPL_ASSERT(( equal_to< get_result, str_hello, start> >::type, char_l > )); // test_empty_input BOOST_MPL_ASSERT((is_error >)); // test_itself BOOST_MPL_ASSERT(( equal< get_remaining >::type, str_ > )); // test_more_than_itself BOOST_MPL_ASSERT(( equal< get_remaining >::type, list_c > )); // test_no_match_at_end BOOST_MPL_ASSERT((is_error >)); // test_no_match_in_the_middle BOOST_MPL_ASSERT((is_error >)); }