Update of /cvsroot/pygccxml/source/pygccxml/unittests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23403/pygccxml/unittests
Modified Files:
test_all.py
Added Files:
calldef_matcher_tester.py filters_tester.py
Log Message:
--- NEW FILE: filters_tester.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under 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)
import os
import unittest
import autoconfig
import parser_test_case
from pygccxml import utils
from pygccxml import parser
from pygccxml import declarations
class tester_t( parser_test_case.parser_test_case_t ):
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
self.header = 'declarations_calldef.hpp'
self.declarations = None
def setUp(self):
if not self.declarations:
self.declarations = parser.parse( [self.header], self.config )
def test_regex( self ):
criteria = declarations.regex_matcher_t( 'oper.*'
, lambda decl: decl.name )
operators = declarations.matcher.find( criteria, self.declarations )
self.failUnless( 6 == len(operators) )
def test_access_type( self ):
criteria = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC )
public_members = declarations.matcher.find( criteria, self.declarations )
self.failUnless( 19 == len( public_members ) )
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
def run_suite():
unittest.TextTestRunner(verbosity=2).run( create_suite() )
if __name__ == "__main__":
run_suite()
Index: test_all.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/unittests/test_all.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** test_all.py 28 Feb 2006 07:11:09 -0000 1.15
--- test_all.py 2 Mar 2006 05:53:14 -0000 1.16
***************
*** 28,31 ****
--- 28,33 ----
import variable_matcher_tester
import namespace_matcher_tester
+ import calldef_matcher_tester
+ import filters_tester
def create_suite():
***************
*** 54,57 ****
--- 56,61 ----
, variable_matcher_tester
, namespace_matcher_tester
+ , calldef_matcher_tester
+ , filters_tester
]
--- NEW FILE: calldef_matcher_tester.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under 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)
import os
import unittest
import autoconfig
import parser_test_case
from pygccxml import utils
from pygccxml import parser
from pygccxml import declarations
class tester_t( parser_test_case.parser_test_case_t ):
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
def __init__(self, *args ):
parser_test_case.parser_test_case_t.__init__( self, *args )
self.header = 'declarations_calldef.hpp'
self.declarations = None
def setUp(self):
if not self.declarations:
self.declarations = parser.parse( [self.header], self.config )
def test( self ):
criteria = declarations.calldef_matcher_t(
name='return_default_args'
, return_type='int'
, arg_types=[ None, declarations.bool_t() ] )
rda = declarations.matcher.get_single( criteria, self.declarations )
self.failUnless( rda, "return_default_args function was not found." )
def create_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite(tester_t))
return suite
def run_suite():
unittest.TextTestRunner(verbosity=2).run( create_suite() )
if __name__ == "__main__":
run_suite()
|