Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57865 - trunk/libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-11-23 11:26:12


Author: hkaiser
Date: 2009-11-23 11:26:11 EST (Mon, 23 Nov 2009)
New Revision: 57865
URL: http://svn.boost.org/trac/boost/changeset/57865

Log:
Spirit: added new test cases
Text files modified:
   trunk/libs/spirit/test/qi/optional.cpp | 13 +++++++++++++
   trunk/libs/spirit/test/qi/sequence.cpp | 8 ++++++++
   2 files changed, 21 insertions(+), 0 deletions(-)

Modified: trunk/libs/spirit/test/qi/optional.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/optional.cpp (original)
+++ trunk/libs/spirit/test/qi/optional.cpp 2009-11-23 11:26:11 EST (Mon, 23 Nov 2009)
@@ -30,6 +30,15 @@
     (boost::optional<int>, b)
 )
 
+struct test_attribute_type
+{
+ template <typename Attribute, typename Context>
+ void operator()(Attribute&, Context&, bool&) const
+ {
+ BOOST_TEST(typeid(Attribute).name() == typeid(boost::optional<int>).name());
+ }
+};
+
 int
 main()
 {
@@ -66,7 +75,11 @@
     }
 
     { // test action
+ boost::optional<int> n = 0;
+ BOOST_TEST((test("1234", (-int_)[test_attribute_type()])));
+ }
 
+ {
         namespace phx = boost::phoenix;
 
         boost::optional<int> n = 0;

Modified: trunk/libs/spirit/test/qi/sequence.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/sequence.cpp (original)
+++ trunk/libs/spirit/test/qi/sequence.cpp 2009-11-23 11:26:11 EST (Mon, 23 Nov 2009)
@@ -148,6 +148,14 @@
 
     }
 
+ {
+ std::vector<char> v;
+ BOOST_TEST(test_attr("ab", char_ >> -char_, v));
+ BOOST_TEST(v.size() == 2);
+ BOOST_TEST(v[0] == 'a');
+ BOOST_TEST(v[1] == 'b');
+ }
+
     { // test action
         using boost::phoenix::ref;
         char c = 0;


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