1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 6 #include <boost/metaparse/util/digit_to_int.hpp> 7 #include <boost/metaparse/error/digit_expected.hpp> 8 9 #include "common.hpp" 10 11 #include <boost/mpl/equal_to.hpp> 12 #include <boost/mpl/apply_wrap.hpp> 13 #include <boost/mpl/bool.hpp> 14 #include <boost/mpl/assert.hpp> 15 16 #include <boost/type_traits/is_same.hpp> 17 18 #include "test_case.hpp" 19 BOOST_METAPARSE_TEST_CASE(digit_to_int)20BOOST_METAPARSE_TEST_CASE(digit_to_int) 21 { 22 using boost::metaparse::util::digit_to_int; 23 using boost::metaparse::error::digit_expected; 24 25 using boost::mpl::equal_to; 26 using boost::mpl::apply_wrap1; 27 using boost::mpl::true_; 28 29 using boost::is_same; 30 31 // test0 32 BOOST_MPL_ASSERT((equal_to<apply_wrap1<digit_to_int<>, char_0>::type, int0>)); 33 34 // test9 35 BOOST_MPL_ASSERT((equal_to<apply_wrap1<digit_to_int<>, char_9>::type, int9>)); 36 37 // test_error 38 BOOST_MPL_ASSERT(( 39 is_same<digit_expected, apply_wrap1<digit_to_int<>, char_x>::type> 40 )); 41 } 42 43