utree_debug.cpp 799 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/detail/lightweight_test.hpp>
  6. #define BOOST_SPIRIT_DEBUG 1
  7. #include <boost/spirit/include/qi.hpp>
  8. #include <boost/spirit/include/support_utree.hpp>
  9. #include <string>
  10. namespace qi = boost::spirit::qi;
  11. namespace spirit = boost::spirit;
  12. int main()
  13. {
  14. qi::rule<std::string::iterator, spirit::utree()> r = qi::int_;
  15. BOOST_SPIRIT_DEBUG_NODE(r);
  16. spirit::utree ut;
  17. std::string input("1");
  18. BOOST_TEST(qi::parse(input.begin(), input.end(), r, ut));
  19. BOOST_TEST(ut.which() == spirit::utree_type::int_type && ut.get<int>() == 1);
  20. return boost::report_errors();
  21. }