$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: hartmut.kaiser_at_[hidden]
Date: 2007-10-28 12:16:52
Author: hkaiser
Date: 2007-10-28 12:16:52 EDT (Sun, 28 Oct 2007)
New Revision: 40531
URL: http://svn.boost.org/trac/boost/changeset/40531
Log:
Added test of real_parser specialized for a custom data type.
Added:
   trunk/libs/spirit/test/custom_real_parser.cpp   (contents, props changed)
Text files modified: 
   trunk/libs/spirit/test/Jamfile.v2 |     1 +                                       
   1 files changed, 1 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/Jamfile.v2
==============================================================================
--- trunk/libs/spirit/test/Jamfile.v2	(original)
+++ trunk/libs/spirit/test/Jamfile.v2	2007-10-28 12:16:52 EDT (Sun, 28 Oct 2007)
@@ -61,6 +61,7 @@
           [ spirit-run char_strings_test.cpp ]
           [ compile-fail char_strings_test_fail.cpp ]
           [ spirit-run numerics_tests.cpp : : : $(opt) ]
+          [ spirit-run custon_real_parser.cpp ]
         ;
 
     test-suite "spirit.core.composite"
Added: trunk/libs/spirit/test/custom_real_parser.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/spirit/test/custom_real_parser.cpp	2007-10-28 12:16:52 EDT (Sun, 28 Oct 2007)
@@ -0,0 +1,33 @@
+/*=============================================================================
+    Copyright (c) 2007 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    Use, modification and distribution is subject to 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/core.hpp>
+#include <boost/spirit/actor.hpp>
+#include <boost/math/concepts/real_concept.hpp>
+
+using namespace boost::spirit;
+using boost::math::concepts::real_concept;
+
+int main(int argc, char* argv[])
+{
+    real_parser<real_concept> const rr_p;
+    bool started = false;
+    real_concept a, b;
+    
+    parse_info<> pi = parse("range 0 1", 
+          str_p("range")[assign_a(started, false)] 
+       && rr_p[assign_a(a)] 
+       && rr_p[assign_a(b)],
+          space_p);
+
+    BOOST_TEST(pi.full && a == 0.0 && b == 1.0);
+    return boost::report_errors();
+}
+