1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
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/unless_error.hpp>
7 #include <boost/metaparse/is_error.hpp>
8 #include <boost/metaparse/fail.hpp>
9 
10 #include "common.hpp"
11 
12 #include <boost/mpl/equal_to.hpp>
13 #include <boost/mpl/apply_wrap.hpp>
14 #include <boost/mpl/assert.hpp>
15 
16 #include "test_case.hpp"
17 
18 namespace
19 {
20   using boost::mpl::apply_wrap2;
21   using boost::metaparse::fail;
22 
23   typedef apply_wrap2<fail<int1>, int11, int2> err;
24 }
25 
BOOST_METAPARSE_TEST_CASE(util_unless_error)26 BOOST_METAPARSE_TEST_CASE(util_unless_error)
27 {
28   using boost::metaparse::is_error;
29   using boost::metaparse::unless_error;
30 
31   using boost::mpl::equal_to;
32 
33   // test_error
34   BOOST_MPL_ASSERT((is_error<unless_error<err, int13> >));
35 
36   // test_not_error
37   BOOST_MPL_ASSERT((equal_to<int13, unless_error<int11, int13>::type>));
38 }
39 
40 
41