Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56636 - in trunk/libs/spirit: repository/test/test_headers test test/karma
From: hartmut.kaiser_at_[hidden]
Date: 2009-10-07 13:14:20


Author: hkaiser
Date: 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
New Revision: 56636
URL: http://svn.boost.org/trac/boost/changeset/56636

Log:
Spirit: disabled Phoenix attributes for V2.1, adjusted tests
Text files modified:
   trunk/libs/spirit/repository/test/test_headers/Jamfile | 9 +++++++--
   trunk/libs/spirit/test/CMakeLists.txt | 5 +++++
   trunk/libs/spirit/test/karma/binary.cpp | 3 +++
   trunk/libs/spirit/test/karma/bool.cpp | 6 +++++-
   trunk/libs/spirit/test/karma/char.cpp | 3 +++
   trunk/libs/spirit/test/karma/int_numerics.cpp | 3 +++
   trunk/libs/spirit/test/karma/real_numerics.cpp | 10 +++++++---
   trunk/libs/spirit/test/karma/repeat.cpp | 3 +++
   8 files changed, 36 insertions(+), 6 deletions(-)

Modified: trunk/libs/spirit/repository/test/test_headers/Jamfile
==============================================================================
--- trunk/libs/spirit/repository/test/test_headers/Jamfile (original)
+++ trunk/libs/spirit/repository/test/test_headers/Jamfile 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -29,6 +29,11 @@
     path.glob-tree ../../../../../boost/spirit/repository/include : *.hpp
 ] ;
 
+main_headers =
+[
+ path.glob-tree ../../../../../boost/spirit/include : *.hpp : classic* phoenix1*
+] ;
+
 for local file in $(headers)
 {
     compile test.cpp
@@ -60,12 +65,12 @@
 }
 
 make auto_all1.cpp
- : $(headers)
+ : $(headers) $(main_headers)
     : @generate-include-all
     ;
 
 make auto_all2.cpp
- : $(headers)
+ : $(headers) $(main_headers)
     : @generate-include-all
     : <generate-include-all-order>reverse
     ;

Modified: trunk/libs/spirit/test/CMakeLists.txt
==============================================================================
--- trunk/libs/spirit/test/CMakeLists.txt (original)
+++ trunk/libs/spirit/test/CMakeLists.txt 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -120,6 +120,11 @@
 
 boost_test_run(lex_regression001 lex/regression001.cpp COMPILE_FLAGS ${test_compile_flags})
 boost_test_run(lex_regression002 lex/regression002.cpp COMPILE_FLAGS ${test_compile_flags})
+boost_test_run(lex_regression004 lex/regression004.cpp COMPILE_FLAGS ${test_compile_flags})
+
+# how to express dependencies? lex_regression003 depends on lex_regression003_generate to be executed first
+# boost_test_run(lex_regression003_generate lex/regression003_generate.cpp COMPILE_FLAGS ${test_compile_flags})
+# boost_test_run(lex_regression003 lex/regression003.cpp COMPILE_FLAGS ${test_compile_flags})
 
 # run support tests
 # boost_test_run(support_hold_any support/hold_any.cpp COMPILE_FLAGS ${test_compile_flags})

Modified: trunk/libs/spirit/test/karma/binary.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/binary.cpp (original)
+++ trunk/libs/spirit/test/karma/binary.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -185,6 +185,8 @@
 #endif
     }
 
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
     { // test Phoenix expression attributes, only supported if
         // karma_phoenix_attributes.hpp is included
         namespace phoenix = boost::phoenix;
@@ -250,6 +252,7 @@
 
 #endif
     }
+#endif
 
     return boost::report_errors();
 }

Modified: trunk/libs/spirit/test/karma/bool.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/bool.cpp (original)
+++ trunk/libs/spirit/test/karma/bool.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -99,7 +99,10 @@
         BOOST_TEST(test("true", bool_, optbool));
     }
 
- // test Phoenix expression attributes (include karma_phoenix_attributes.hpp)
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
+ // test Phoenix expression attributes (requires to include
+ // karma_phoenix_attributes.hpp)
     {
         namespace phoenix = boost::phoenix;
 
@@ -109,6 +112,7 @@
         BOOST_TEST(test("false", bool_, phoenix::ref(b)));
         BOOST_TEST(test("true", bool_, ++phoenix::ref(b)));
     }
+#endif
 
     {
         BOOST_TEST(test("false", lower[bool_], false));

Modified: trunk/libs/spirit/test/karma/char.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/char.cpp (original)
+++ trunk/libs/spirit/test/karma/char.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -283,6 +283,8 @@
         BOOST_TEST(!test(L"", wide::char_(L'y'), w));
     }
 
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
     // yes, we can use phoenix expressions as attributes as well
     // but only if we include karma_phoenix_attributes.hpp
     {
@@ -295,6 +297,7 @@
         BOOST_TEST(test("x", ascii::char_, phoenix::ref(c)));
         BOOST_TEST(test("y", ascii::char_, ++phoenix::ref(c)));
     }
+#endif
 
     return boost::report_errors();
 }

Modified: trunk/libs/spirit/test/karma/int_numerics.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/int_numerics.cpp (original)
+++ trunk/libs/spirit/test/karma/int_numerics.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -92,6 +92,8 @@
         BOOST_TEST(test(expected_minval, gen(minval), optmin));
         BOOST_TEST(test(expected_maxval, gen(maxval), optmax));
 
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
     // Phoenix expression tests (only supported while including
     // karma_phoenix_attributes.hpp
         namespace phoenix = boost::phoenix;
@@ -101,6 +103,7 @@
         T val = 1;
         BOOST_TEST(test("1", gen, phoenix::ref(val)));
         BOOST_TEST(test("2", gen, ++phoenix::ref(val)));
+#endif
     }
 };
 

Modified: trunk/libs/spirit/test/karma/real_numerics.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/real_numerics.cpp (original)
+++ trunk/libs/spirit/test/karma/real_numerics.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -35,8 +35,8 @@
     static int floatfield(T) { return base_type::fmtflags::scientific; }
 };
 
-// ///////////////////////////////////////////////////////////////////////////////
-// // policy for real_generator, which forces the fixed notation
+///////////////////////////////////////////////////////////////////////////////
+// policy for real_generator, which forces the fixed notation
 template <typename T>
 struct fixed_policy : boost::spirit::karma::real_policies<T>
 {
@@ -538,7 +538,10 @@
         BOOST_TEST(test("1.0", double_(1.0), v));
     }
 
- { // Phoenix expression tests (include karma_phoenix_attributes.hpp)
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
+ { // Phoenix expression tests (requires to include
+ // karma_phoenix_attributes.hpp)
         namespace phoenix = boost::phoenix;
 
         BOOST_TEST(test("1.0", double_, phoenix::val(1.0)));
@@ -547,6 +550,7 @@
         BOOST_TEST(test("1.2", double_, phoenix::ref(d)));
         BOOST_TEST(test("2.2", double_, ++phoenix::ref(d)));
     }
+#endif
 
     return boost::report_errors();
 }

Modified: trunk/libs/spirit/test/karma/repeat.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/repeat.cpp (original)
+++ trunk/libs/spirit/test/karma/repeat.cpp 2009-10-07 13:14:19 EDT (Wed, 07 Oct 2009)
@@ -161,6 +161,8 @@
         BOOST_TEST(!test("", repeat(4, inf)[r], v3));
     }
 
+// we support Phoenix attributes only starting with V2.2
+#if SPIRIT_VERSION >= 0x2020
     {
         namespace ascii = boost::spirit::ascii;
         namespace phoenix = boost::phoenix;
@@ -171,6 +173,7 @@
         c = 'a';
         BOOST_TEST(test("bcd", repeat(3)[ascii::char_], ++phoenix::ref(c)));
     }
+#endif
 
     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