Update of /cvsroot/pygccxml/source/pygccxml/unittests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10238/pygccxml/unittests
Modified Files:
filters_tester.py
Log Message:
adding [or|and|not]_matcher_t classes and test cases to pygccxml
Index: filters_tester.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/filters_tester.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** filters_tester.py 2 Mar 2006 05:53:15 -0000 1.1
--- filters_tester.py 16 Mar 2006 06:31:29 -0000 1.2
***************
*** 34,38 ****
--- 34,57 ----
public_members = declarations.matcher.find( criteria, self.declarations )
self.failUnless( 19 == len( public_members ) )
+
+ def test_or_matcher( self ):
+ criteria1 = declarations.regex_matcher_t( 'oper.*'
+ , lambda decl: decl.name )
+ criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
+ found = declarations.matcher.find( criteria1 | criteria2, self.declarations )
+ self.failUnless( 19 <= len( found ) <= 25 )
+ def test_and_matcher( self ):
+ criteria1 = declarations.regex_matcher_t( 'oper.*'
+ , lambda decl: decl.name )
+ criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
+ found = declarations.matcher.find( criteria1 & criteria2, self.declarations )
+ self.failUnless( len( found ) <= 6 )
+
+ def test_not_matcher( self ):
+ criteria1 = declarations.regex_matcher_t( 'oper.*'
+ , lambda decl: decl.name )
+ found = declarations.matcher.find( ~( ~criteria1 ), self.declarations )
+ self.failUnless( len( found ) == 6 )
def create_suite():
|