Update of /cvsroot/boost/boost/libs/xpressive/proto/test
In directory 
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18239/libs/xpressive/proto/test

Modified Files:
        matches.cpp 
Log Message:
new rules for matching terminals, less fuzzy, avoid is_convertible, add 
convertible_to<> helper

Index: matches.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/proto/test/matches.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- matches.cpp 6 Apr 2007 23:59:10 -0000       1.3
+++ matches.cpp 12 Apr 2007 23:44:40 -0000      1.4
@@ -88,17 +88,21 @@
     assert_matches< terminal<int> >( as_arg(1) );
     assert_matches< terminal<int> >( as_expr(1) );
 
-    assert_matches< terminal<int> >( lit('a') );
-    assert_matches< terminal<int> >( as_arg('a') );
-    assert_matches< terminal<int> >( as_expr('a') );
+    assert_not_matches< terminal<int> >( lit('a') );
+    assert_not_matches< terminal<int> >( as_arg('a') );
+    assert_not_matches< terminal<int> >( as_expr('a') );
+
+    assert_matches< terminal<convertible_to<int> > >( lit('a') );
+    assert_matches< terminal<convertible_to<int> > >( as_arg('a') );
+    assert_matches< terminal<convertible_to<int> > >( as_expr('a') );
 
     assert_not_matches< terminal<int> >( lit((int_convertible())) );
     assert_not_matches< terminal<int> >( as_arg((int_convertible())) );
     assert_not_matches< terminal<int> >( as_expr((int_convertible())) );
 
-    assert_matches< terminal<_> >( lit(1) );
-    assert_matches< terminal<_> >( as_arg(1) );
-    assert_matches< terminal<_> >( as_expr(1) );
+    assert_matches< terminal<convertible_to<int> > >( lit((int_convertible())) 
);
+    assert_matches< terminal<convertible_to<int> > >( 
as_arg((int_convertible())) );
+    assert_matches< terminal<convertible_to<int> > >( 
as_expr((int_convertible())) );
 
     assert_matches< if_<is_same<proto::result_of::arg<mpl::_>, int> > >( 
lit(1) );
     assert_not_matches< if_<is_same<proto::result_of::arg<mpl::_>, int> > >( 
lit('a') );
@@ -137,17 +141,29 @@
     assert_matches< terminal<std::basic_string<_> > >( 
as_arg(std::string("hello")) );
     assert_matches< terminal<std::basic_string<_> > >( 
as_expr(std::string("hello")) );
 
+    assert_not_matches< terminal<std::basic_string<_> > >( lit(1) );
+    assert_not_matches< terminal<std::basic_string<_> > >( as_arg(1) );
+    assert_not_matches< terminal<std::basic_string<_> > >( as_expr(1) );
+
+    assert_not_matches< terminal<std::basic_string<_,_,_> > >( lit(1) );
+    assert_not_matches< terminal<std::basic_string<_,_,_> > >( as_arg(1) );
+    assert_not_matches< terminal<std::basic_string<_,_,_> > >( as_expr(1) );
+
     assert_matches< terminal<std::basic_string<_> const & > >( 
lit(std::string("hello")) );
     assert_matches< terminal<std::basic_string<_> const & > >( 
as_arg(std::string("hello")) );
-    assert_matches< terminal<std::basic_string<_> const & > >( 
as_expr(std::string("hello")) );
+    assert_not_matches< terminal<std::basic_string<_> const & > >( 
as_expr(std::string("hello")) );
 
     assert_matches< terminal< void(&)() > >( lit(a_function) );
     assert_matches< terminal< void(&)() > >( as_arg(a_function) );
     assert_matches< terminal< void(&)() > >( as_expr(a_function) );
 
-    assert_matches< terminal< void(*)() > >( lit(a_function) );
-    assert_matches< terminal< void(*)() > >( as_arg(a_function) );
-    assert_matches< terminal< void(*)() > >( as_expr(a_function) );
+    assert_not_matches< terminal< void(*)() > >( lit(a_function) );
+    assert_not_matches< terminal< void(*)() > >( as_arg(a_function) );
+    assert_not_matches< terminal< void(*)() > >( as_expr(a_function) );
+
+    assert_matches< terminal< convertible_to<void(*)()> > >( lit(a_function) );
+    assert_matches< terminal< convertible_to<void(*)()> > >( 
as_arg(a_function) );
+    assert_matches< terminal< convertible_to<void(*)()> > >( 
as_expr(a_function) );
 
     assert_matches< terminal< void(*)() > >( lit(&a_function) );
     assert_matches< terminal< void(*)() > >( as_arg(&a_function) );
@@ -155,7 +171,7 @@
 
     assert_matches< terminal< void(* const &)() > >( lit(&a_function) );
     assert_matches< terminal< void(* const &)() > >( as_arg(&a_function) );
-    assert_matches< terminal< void(* const &)() > >( as_expr(&a_function) );
+    assert_not_matches< terminal< void(* const &)() > >( as_expr(&a_function) 
);
 
     assert_matches<
         or_<


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to