Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61426 - in trunk/libs/spirit/test: . karma
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-20 10:37:59


Author: hkaiser
Date: 2010-04-20 10:37:58 EDT (Tue, 20 Apr 2010)
New Revision: 61426
URL: http://svn.boost.org/trac/boost/changeset/61426

Log:
Spirit: added regression test
Added:
   trunk/libs/spirit/test/karma/semantic_action_attribute.cpp (contents, props changed)
Text files modified:
   trunk/libs/spirit/test/Jamfile | 7 ++++---
   1 files changed, 4 insertions(+), 3 deletions(-)

Modified: trunk/libs/spirit/test/Jamfile
==============================================================================
--- trunk/libs/spirit/test/Jamfile (original)
+++ trunk/libs/spirit/test/Jamfile 2010-04-20 10:37:58 EDT (Tue, 20 Apr 2010)
@@ -151,9 +151,10 @@
 
 
     # regression tests
- [ run qi/clear_test.cpp : : : : ]
- [ run qi/reorder_test.cpp : : : : ]
- [ run karma/karma_optional_double.cpp : : : : ]
+ [ run qi/clear_test.cpp : : : : ]
+ [ run qi/reorder_test.cpp : : : : ]
+ [ run karma/karma_optional_double.cpp : : : : ]
+ [ run karma/semantic_action_attribute.cpp : : : : ]
 
     ;
 

Added: trunk/libs/spirit/test/karma/semantic_action_attribute.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/karma/semantic_action_attribute.cpp 2010-04-20 10:37:58 EDT (Tue, 20 Apr 2010)
@@ -0,0 +1,35 @@
+// Copyright (c) 2010 Michael Caisse
+// 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/config/warning_disable.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <string>
+#include <vector>
+#include <boost/spirit/include/karma.hpp>
+#include <boost/spirit/include/phoenix.hpp>
+
+#include "test.hpp"
+
+using namespace spirit_test;
+
+namespace karma = boost::spirit::karma;
+namespace phx = boost::phoenix;
+
+int main()
+{
+ using karma::int_;
+ using karma::_1;
+
+ BOOST_TEST(test("16909060", int_[ _1 = phx::val(0x01020304) ]));
+
+ // make sure the passed attribute type does not enforce the attribute type
+ // for the semantic action
+ unsigned char char_value = 8;
+ BOOST_TEST(test("16909060", int_[ _1 = phx::val(0x01020304) ], char_value));
+
+ 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