• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2015 Joel de Guzman
3     Copyright (c) 2001-2010 Hartmut Kaiser
4 
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #include <boost/detail/lightweight_test.hpp>
9 #include <boost/spirit/home/x3.hpp>
10 #include <iostream>
11 #include "test.hpp"
12 
13 int
main()14 main()
15 {
16     using spirit_test::test;
17     using spirit_test::test_attr;
18     using boost::spirit::x3::matches;
19     using boost::spirit::x3::char_;
20 
21     BOOST_SPIRIT_ASSERT_CONSTEXPR_CTORS(matches['x']);
22 
23     {
24         BOOST_TEST(test("x", matches[char_]));
25         bool result = false;
26         BOOST_TEST(test_attr("x", matches[char_], result) && result);
27     }
28 
29     {
30         BOOST_TEST(!test("y", matches[char_('x')]));
31         BOOST_TEST(!test("y", matches['x']));
32         bool result = true;
33         BOOST_TEST(test_attr("y", matches[char_('x')], result, false) && !result);
34         result = true;
35         BOOST_TEST(test_attr("y", matches['x'], result, false) && !result);
36     }
37 
38     return boost::report_errors();
39 }
40