Update of /cvsroot/boost/boost/libs/xpressive/proto/test
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20652/libs/xpressive/proto/test
Modified Files:
matches.cpp
Log Message:
fix proto::matches<> bug
Index: matches.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/proto/test/matches.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- matches.cpp 12 Apr 2007 23:44:40 -0000 1.4
+++ matches.cpp 17 Apr 2007 16:32:33 -0000 1.5
@@ -78,6 +78,32 @@
: proto::_
{};
+enum binary_representation_enum
+{
+ magnitude
+ , two_complement
+};
+
+typedef
+ mpl::integral_c<binary_representation_enum, magnitude>
+magnitude_c;
+
+typedef
+ mpl::integral_c<binary_representation_enum, two_complement>
+two_complement_c;
+
+template<typename Type, typename Representation>
+struct number
+{};
+
+struct NumberGrammar
+ : proto::or_ <
+ proto::terminal<number<proto::_, two_complement_c> >
+ , proto::terminal<number<proto::_, magnitude_c> >
+ >
+{};
+
+
void test_matches()
{
assert_matches< _ >( lit(1) );
@@ -201,6 +227,9 @@
assert_matches< proto::switch_<MyCases> >( lit(1) >> 'a' );
assert_matches< proto::switch_<MyCases> >( lit(1) + 'a' );
assert_not_matches< proto::switch_<MyCases> >( lit(1) << 'a' );
+
+ number<int, two_complement_c> num;
+ assert_matches<NumberGrammar>(proto::as_expr(num));
}
using namespace unit_test;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs