|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58798 - in trunk/libs/spirit/test: . qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-07 21:35:10
Author: hkaiser
Date: 2010-01-07 21:35:10 EST (Thu, 07 Jan 2010)
New Revision: 58798
URL: http://svn.boost.org/trac/boost/changeset/58798
Log:
Spirit: adding tests for the matches[] directive
Added:
trunk/libs/spirit/test/qi/matches.cpp (contents, props changed)
Text files modified:
trunk/libs/spirit/test/Jamfile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/Jamfile
==============================================================================
--- trunk/libs/spirit/test/Jamfile (original)
+++ trunk/libs/spirit/test/Jamfile 2010-01-07 21:35:10 EST (Thu, 07 Jan 2010)
@@ -50,6 +50,7 @@
[ run qi/list.cpp : : : : ]
[ run qi/match_manip.cpp : : : : ]
[ run qi/match_manip_attr.cpp : : : : ]
+ [ run qi/matches.cpp : : : : ]
[ run qi/no_case.cpp : : : : ]
[ run qi/not_predicate.cpp : : : : ]
[ run qi/optional.cpp : : : : ]
Added: trunk/libs/spirit/test/qi/matches.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/qi/matches.cpp 2010-01-07 21:35:10 EST (Thu, 07 Jan 2010)
@@ -0,0 +1,40 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Hartmut Kaiser
+
+ 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)
+=============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_directive.hpp>
+
+#include <iostream>
+#include "test.hpp"
+
+namespace qi = boost::spirit::qi;
+
+int main()
+{
+ using spirit_test::test;
+ using spirit_test::test_attr;
+ using qi::matches;
+ using qi::char_;
+
+ {
+ BOOST_TEST(test("x", matches[char_]));
+ bool result = false;
+ BOOST_TEST(test_attr("x", matches[char_], result) && result);
+ }
+
+ {
+ BOOST_TEST(!test("y", matches[char_('x')]));
+ BOOST_TEST(!test("y", matches['x']));
+ bool result = true;
+ BOOST_TEST(!test_attr("y", matches[char_('x')], result) && !result);
+ result = true;
+ BOOST_TEST(!test_attr("y", matches['x'], result) && !result);
+ }
+
+ 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