|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67693 - in trunk/libs/spirit/test: karma qi support
From: hartmut.kaiser_at_[hidden]
Date: 2011-01-05 17:38:12
Author: hkaiser
Date: 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
New Revision: 67693
URL: http://svn.boost.org/trac/boost/changeset/67693
Log:
Spirit: added more tests
Text files modified:
trunk/libs/spirit/test/karma/utree1.cpp | 4 ++--
trunk/libs/spirit/test/karma/utree2.cpp | 4 ++--
trunk/libs/spirit/test/karma/utree3.cpp | 4 ++--
trunk/libs/spirit/test/qi/utree1.cpp | 4 ++--
trunk/libs/spirit/test/qi/utree2.cpp | 4 ++--
trunk/libs/spirit/test/qi/utree3.cpp | 4 ++--
trunk/libs/spirit/test/qi/utree4.cpp | 13 +++++++++++--
trunk/libs/spirit/test/support/utree.cpp | 23 +++++++++++++++++------
8 files changed, 40 insertions(+), 20 deletions(-)
Modified: trunk/libs/spirit/test/karma/utree1.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree1.cpp (original)
+++ trunk/libs/spirit/test/karma/utree1.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/karma/utree2.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree2.cpp (original)
+++ trunk/libs/spirit/test/karma/utree2.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/karma/utree3.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/utree3.cpp (original)
+++ trunk/libs/spirit/test/karma/utree3.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/qi/utree1.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree1.cpp (original)
+++ trunk/libs/spirit/test/qi/utree1.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/qi/utree2.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree2.cpp (original)
+++ trunk/libs/spirit/test/qi/utree2.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/qi/utree3.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree3.cpp (original)
+++ trunk/libs/spirit/test/qi/utree3.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/libs/spirit/test/qi/utree4.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree4.cpp (original)
+++ trunk/libs/spirit/test/qi/utree4.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2010 Hartmut Kaiser
-// Copyright (c) 2001-2010 Joel de Guzman
+// Copyright (c) 2001-2011 Hartmut Kaiser
+// Copyright (c) 2001-2011 Joel de Guzman
// Copyright (c) 2010 Bryce Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -151,6 +151,10 @@
ut.which() == utree_type::list_type && check(ut, "( 1 1 )"));
ut.clear();
+ BOOST_TEST(test_attr("1 ", int_ >> ' ' >> -r4, ut) &&
+ ut.which() == utree_type::list_type && check(ut, "( 1 )"));
+ ut.clear();
+
rule<char const*, utree::list_type()> r5 = -r4;
BOOST_TEST(test_attr("1", r5, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1 )"));
@@ -169,6 +173,11 @@
BOOST_TEST(test_attr("1", r7, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1 )"));
ut.clear();
+
+ rule<char const*, utree::list_type()> r8 = r6 >> ' ' >> r6;
+ BOOST_TEST(test_attr("1 1", r8, ut) &&
+ ut.which() == utree_type::list_type && check(ut, "( ( 1 ) ( 1 ) )"));
+ ut.clear();
}
return boost::report_errors();
Modified: trunk/libs/spirit/test/support/utree.cpp
==============================================================================
--- trunk/libs/spirit/test/support/utree.cpp (original)
+++ trunk/libs/spirit/test/support/utree.cpp 2011-01-05 17:38:10 EST (Wed, 05 Jan 2011)
@@ -50,12 +50,16 @@
}
{
- utree val = utree::nil_type();
+ using boost::spirit::nil;
+
+ utree val(nil);
BOOST_TEST(check(val, "<nil>"));
}
{
- utree val = utree::list_type();
+ using boost::spirit::empty_list;
+
+ utree val(empty_list);
BOOST_TEST(check(val, "( )"));
}
@@ -139,6 +143,8 @@
}
{
+ using boost::spirit::nil;
+
utree val;
val.push_back(123);
val.push_back("Chuckie");
@@ -151,7 +157,7 @@
BOOST_TEST(check(val, "( 123 \"Chuckie\" ( 123.456 \"Mah Doggie\" ) )"));
BOOST_TEST(check(val.front(), "123"));
- utree val3 = utree::nil_type();
+ utree val3(nil);
val3.swap(val);
BOOST_TEST(val3.size() == 3);
BOOST_TEST(check(val, "<nil>"));
@@ -191,7 +197,10 @@
}
{
- utree a = utree::nil_type(), b = utree::nil_type();
+ using boost::spirit::nil;
+ using boost::spirit::invalid;
+
+ utree a(nil), b(nil);
BOOST_TEST(a == b);
a = 123;
BOOST_TEST(a != b);
@@ -200,7 +209,7 @@
a = 100.00;
BOOST_TEST(a < b);
- b = a = utree::invalid_type();
+ b = a = utree(invalid);
BOOST_TEST(a == b);
a.push_back(1);
a.push_back("two");
@@ -215,7 +224,9 @@
}
{
- utree a = utree::list_type();
+ using boost::spirit::empty_list;
+
+ utree a(empty_list);
a.push_back(1);
a.push_back(2);
a.push_back(3);
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