• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
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/config.hpp>
7 #if BOOST_METAPARSE_STD >= 2011
8 #  include <boost/metaparse/v1/cpp11/impl/size.hpp>
9 #else
10 #  include <boost/metaparse/v1/cpp98/impl/size.hpp>
11 #endif
12 
13 #include <boost/metaparse/string.hpp>
14 
15 #include <boost/mpl/equal_to.hpp>
16 #include <boost/mpl/int.hpp>
17 #include <boost/mpl/assert.hpp>
18 
19 #include "test_case.hpp"
20 
BOOST_METAPARSE_TEST_CASE(size)21 BOOST_METAPARSE_TEST_CASE(size)
22 {
23   using boost::metaparse::v1::impl::size;
24   using boost::metaparse::string;
25 
26   using boost::mpl::equal_to;
27   using boost::mpl::int_;
28 
29   // test_0
30   BOOST_MPL_ASSERT((equal_to<int_<0>, size<string<> >::type>));
31 
32   // test_1_
33   BOOST_MPL_ASSERT((equal_to<int_<1>, size<string<'x'> >::type>));
34 
35   // test_5
36   BOOST_MPL_ASSERT((equal_to<int_<4>, size<string<'1','2','3','4'> >::type>));
37 
38 }
39 
40 
41