|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66995 - trunk/libs/spirit/test/qi
From: joel_at_[hidden]
Date: 2010-12-03 18:54:40
Author: djowel
Date: 2010-12-03 18:54:39 EST (Fri, 03 Dec 2010)
New Revision: 66995
URL: http://svn.boost.org/trac/boost/changeset/66995
Log:
Utree-spirit integration
Text files modified:
trunk/libs/spirit/test/qi/utree.cpp | 66 ++++++++++++++++++++--------------------
1 files changed, 33 insertions(+), 33 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-12-03 18:54:39 EST (Fri, 03 Dec 2010)
@@ -1,6 +1,6 @@
// Copyright (c) 2001-2010 Hartmut Kaiser
// Copyright (c) 2001-2010 Joel de Guzman
-//
+//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -37,13 +37,13 @@
// primitive data types
{
utree ut;
- BOOST_TEST(test_attr("x", char_, ut) &&
+ BOOST_TEST(test_attr("x", char_, ut) &&
ut.which() == utree_type::string_type && check(ut, "\"x\""));
ut.clear();
- BOOST_TEST(test_attr("123", int_, ut) &&
+ BOOST_TEST(test_attr("123", int_, ut) &&
ut.which() == utree_type::int_type && check(ut, "123"));
ut.clear();
- BOOST_TEST(test_attr("123.45", double_, ut) &&
+ BOOST_TEST(test_attr("123.45", double_, ut) &&
ut.which() == utree_type::double_type && check(ut, "123.45"));
}
@@ -52,75 +52,75 @@
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
+ BOOST_TEST(test_attr("xy", char_ >> char_, ut) &&
+ ut.which() == utree_type::string_type && check(ut, "\"xy\""));
ut.clear();
- BOOST_TEST(test_attr("123 456", int_ >> int_, ut, space) &&
+ BOOST_TEST(test_attr("123 456", int_ >> int_, ut, space) &&
ut.which() == utree_type::list_type && check(ut, "( 123 456 )"));
ut.clear();
- BOOST_TEST(test_attr("1.23 4.56", double_ >> double_, ut, space) &&
+ 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) &&
+ 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) &&
+ BOOST_TEST(test_attr("ab1.2", *~digit >> double_, ut) &&
ut.which() == utree_type::list_type && check(ut, "( \"a\" \"b\" 1.2 )"));
rule<char const*, utree()> r = double_;
ut.clear();
- BOOST_TEST(test_attr("1.2ab", r >> *char_, ut) &&
+ BOOST_TEST(test_attr("1.2ab", r >> *char_, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1.2 \"a\" \"b\" )"));
ut.clear();
- BOOST_TEST(test_attr("ab1.2", *~digit >> r, ut) &&
+ BOOST_TEST(test_attr("ab1.2", *~digit >> r, ut) &&
ut.which() == utree_type::list_type && check(ut, "( \"a\" \"b\" 1.2 )"));
}
// kleene star
{
utree ut;
- BOOST_TEST(test_attr("xy", *char_, ut) &&
- ut.which() == utree_type::list_type && check(ut, "( \"x\" \"y\" )")); // should be "( \"xy\" )" instead
+ BOOST_TEST(test_attr("xy", *char_, ut) &&
+ ut.which() == utree_type::string_type && check(ut, "\"xy\""));
ut.clear();
- BOOST_TEST(test_attr("123 456", *int_, ut, space) &&
+ BOOST_TEST(test_attr("123 456", *int_, ut, space) &&
ut.which() == utree_type::list_type && check(ut, "( 123 456 )"));
ut.clear();
- BOOST_TEST(test_attr("1.23 4.56", *double_, ut, space) &&
+ BOOST_TEST(test_attr("1.23 4.56", *double_, ut, space) &&
ut.which() == utree_type::list_type && check(ut, "( 1.23 4.56 )"));
}
// lists
{
utree ut;
- BOOST_TEST(test_attr("x,y", char_ % ',', ut) &&
- ut.which() == utree_type::list_type && check(ut, "( \"x\" \"y\" )"));
+ BOOST_TEST(test_attr("x,y", char_ % ',', ut) &&
+ ut.which() == utree_type::string_type && check(ut, "\"xy\""));
ut.clear();
- BOOST_TEST(test_attr("123,456", int_ % ',', ut) &&
+ BOOST_TEST(test_attr("123,456", int_ % ',', ut) &&
ut.which() == utree_type::list_type && check(ut, "( 123 456 )"));
ut.clear();
- BOOST_TEST(test_attr("1.23,4.56", double_ % ',', ut) &&
+ BOOST_TEST(test_attr("1.23,4.56", double_ % ',', ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1.23 4.56 )"));
rule<char const*, std::vector<char>()> r1 = char_ % ',';
ut.clear();
- BOOST_TEST(test_attr("x,y", r1, ut) &&
+ BOOST_TEST(test_attr("x,y", r1, ut) &&
ut.which() == utree_type::list_type && check(ut, "( \"x\" \"y\" )"));
rule<char const*, std::vector<int>()> r2 = int_ % ',';
ut.clear();
- BOOST_TEST(test_attr("123,456", r2, ut) &&
+ BOOST_TEST(test_attr("123,456", r2, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 123 456 )"));
rule<char const*, std::vector<double>()> r3 = double_ % ',';
ut.clear();
- BOOST_TEST(test_attr("1.23,4.56", r3, ut) &&
+ BOOST_TEST(test_attr("1.23,4.56", r3, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1.23 4.56 )"));
rule<char const*, utree()> r4 = double_ % ',';
ut.clear();
- BOOST_TEST(test_attr("1.23,4.56", r4, ut) &&
+ BOOST_TEST(test_attr("1.23,4.56", r4, ut) &&
ut.which() == utree_type::list_type && check(ut, "( 1.23 4.56 )"));
}
@@ -129,43 +129,43 @@
using boost::spirit::qi::real_parser;
using boost::spirit::qi::strict_real_policies;
- typedef real_parser<double, strict_real_policies<double> >
+ typedef real_parser<double, strict_real_policies<double> >
strict_double_type;
strict_double_type const strict_double = strict_double_type();
utree ut;
- BOOST_TEST(test_attr("10", strict_double | int_, ut) &&
+ BOOST_TEST(test_attr("10", strict_double | int_, ut) &&
ut.which() == utree_type::int_type && check(ut, "10"));
ut.clear();
- BOOST_TEST(test_attr("10.2", strict_double | int_, ut) &&
+ BOOST_TEST(test_attr("10.2", strict_double | int_, ut) &&
ut.which() == utree_type::double_type && check(ut, "10.2"));
rule<char const*, boost::variant<int, double>()> r1 = strict_double | int_;
ut.clear();
- BOOST_TEST(test_attr("10", r1, ut) &&
+ BOOST_TEST(test_attr("10", r1, ut) &&
ut.which() == utree_type::int_type && check(ut, "10"));
ut.clear();
- BOOST_TEST(test_attr("10.2", r1, ut) &&
+ BOOST_TEST(test_attr("10.2", r1, ut) &&
ut.which() == utree_type::double_type && check(ut, "10.2"));
rule<char const*, utree()> r2 = strict_double | int_;
ut.clear();
- BOOST_TEST(test_attr("10", r2, ut) &&
+ BOOST_TEST(test_attr("10", r2, ut) &&
ut.which() == utree_type::int_type && check(ut, "10"));
ut.clear();
- BOOST_TEST(test_attr("10.2", r2, ut) &&
+ BOOST_TEST(test_attr("10.2", r2, ut) &&
ut.which() == utree_type::double_type && check(ut, "10.2"));
}
// optionals
{
utree ut;
- BOOST_TEST(test_attr("x", -char_, 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) &&
+ BOOST_TEST(test_attr("", -char_, ut) &&
ut.which() == utree_type::nil_type && check(ut, "<nil>"));
}
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