|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66935 - trunk/libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-11-30 17:55:29
Author: hkaiser
Date: 2010-11-30 17:55:27 EST (Tue, 30 Nov 2010)
New Revision: 66935
URL: http://svn.boost.org/trac/boost/changeset/66935
Log:
Spirit: more utree tests
Text files modified:
trunk/libs/spirit/test/qi/utree.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/qi/utree.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree.cpp (original)
+++ trunk/libs/spirit/test/qi/utree.cpp 2010-11-30 17:55:27 EST (Tue, 30 Nov 2010)
@@ -49,6 +49,8 @@
// sequences
{
+ using boost::spirit::qi::digit;
+
utree ut;
BOOST_TEST(test_attr("xy", char_ >> char_, ut) &&
ut.which() == utree_type::list_type && check(ut, "( \"x\" \"y\" )")); // should be "( \"xy\" )" instead
@@ -58,6 +60,13 @@
ut.clear();
BOOST_TEST(test_attr("1.23 4.56", double_ >> double_, ut, space) &&
ut.which() == utree_type::list_type && check(ut, "( 1.23 4.56 )"));
+
+ ut.clear();
+ BOOST_TEST(test_attr("1.2ab", double_ >> *char_, ut) &&
+ ut.which() == utree_type::list_type && check(ut, "( 1.2 \"a\" \"b\" )"));
+ ut.clear();
+ BOOST_TEST(test_attr("ab1.2", *~digit >> double_, ut) &&
+ ut.which() == utree_type::list_type && check(ut, "( \"a\" \"b\" 1.2 )"));
}
// kleene star
@@ -127,5 +136,15 @@
ut.which() == utree_type::double_type && check(ut, "10.2"));
}
+ // optionals
+ {
+ utree ut;
+ BOOST_TEST(test_attr("x", -char_, ut) &&
+ ut.which() == utree_type::string_type && check(ut, "\"x\""));
+ ut.clear();
+ BOOST_TEST(test_attr("", -char_, ut) &&
+ ut.which() == utree_type::nil_type && check(ut, "<nil>"));
+ }
+
return boost::report_errors();
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk