|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57905 - trunk/libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-24 15:57:06
Author: hkaiser
Date: 2009-11-24 15:57:05 EST (Tue, 24 Nov 2009)
New Revision: 57905
URL: http://svn.boost.org/trac/boost/changeset/57905
Log:
Spirit: added specializations for the push_back CP for optional attribute values, adjusted tests
Text files modified:
trunk/libs/spirit/test/qi/alternative.cpp | 19 ++++++-------------
trunk/libs/spirit/test/qi/kleene.cpp | 8 +++++++-
2 files changed, 13 insertions(+), 14 deletions(-)
Modified: trunk/libs/spirit/test/qi/alternative.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/alternative.cpp (original)
+++ trunk/libs/spirit/test/qi/alternative.cpp 2009-11-24 15:57:05 EST (Tue, 24 Nov 2009)
@@ -49,13 +49,11 @@
, boost::spirit::unused_type
, boost::spirit::unused_type) const
{
- using boost::get;
-
- BOOST_TEST(v.size() == 5 &&
- v[1] == 'a' &&
- v[2] == 'b' &&
- v[3] == '1' &&
- v[4] == '2');
+ BOOST_TEST(v.size() == 4 &&
+ v[0] == 'a' &&
+ v[1] == 'b' &&
+ v[2] == '1' &&
+ v[3] == '2');
}
};
@@ -174,7 +172,6 @@
using boost::spirit::ascii::string;
namespace phx = boost::phoenix;
-
BOOST_TEST( (test("ab1_", (*(alnum | char_('_')))[test_action('_')])) );
BOOST_TEST( (test("ab12", (*(alpha | digit))[test_action('2')])) );
@@ -182,11 +179,7 @@
std::vector<boost::optional<char> > v;
BOOST_TEST( (test("x,y,z", (*(',' | char_))[phx::ref(v) = _1])) );
- assert(v[0] == 'x');
- assert(!v[1]);
- assert(v[2] == 'y');
- assert(!v[3]);
- assert(v[4] == 'z');
+ BOOST_TEST(v.size() == 3 && v[0] == 'x' && v[1] == 'y' && v[2] == 'z');
}
{
Modified: trunk/libs/spirit/test/qi/kleene.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/kleene.cpp (original)
+++ trunk/libs/spirit/test/qi/kleene.cpp 2009-11-24 15:57:05 EST (Tue, 24 Nov 2009)
@@ -106,13 +106,19 @@
BOOST_TEST(test_attr("123 456 789 10", *int_, v, space) && 4 == v.size() &&
v[0] == 123 && v[1] == 456 && v[2] == 789 && v[3] == 10);
}
-
+
{
std::vector<std::string> v;
BOOST_TEST(test_attr("a b c d", *lexeme[+alpha], v, space) && 4 == v.size() &&
v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
}
+// {
+// std::vector<char> v;
+// BOOST_TEST(test_attr("abc", *('a' | char_), v));
+// BOOST_TEST(v.size() == 2 && v[0] == 'b' && v[1] == 'c');
+// }
+
{
std::vector<int> v;
BOOST_TEST(test_attr("123 456 789", *int_, v, space) && 3 == v.size() &&
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