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.global_ns ) found = filter( lambda d: not d.is_artificial, found ) self.failUnless( len( found ) <= 6 )
def test_regex(self): criteria = declarations.regex_matcher_t( 'oper.*', lambda decl: decl.name) operators = declarations.matcher.find(criteria, self.global_ns) operators = [d for d in operators if not d.is_artificial] self.failUnless(6 == len(operators))
def test_not_matcher(self): criteria1 = declarations.regex_matcher_t( 'oper.*', lambda decl: decl.name) found = declarations.matcher.find(~(~criteria1), self.global_ns) found = [d for d in found if not d.is_artificial] self.failUnless(len(found) == 6)
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.global_ns) found = [d for d in found if not d.is_artificial] self.assertTrue(len(found) <= 6)
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.global_ns ) if '0.9' in found[0].compiler: found = filter( lambda d: not d.is_artificial, found ) self.failUnless( 15 <= len( found ) <= 21) else: self.failUnless( 19 <= len( found ) <= 25)
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 ) if '0.9' in found[0].compiler: #2 empty classes, this compiler doesn't generate constructor and copy constructor self.failUnless( 15 <= len( found ) <= 21) else: self.failUnless( 19 <= len( found ) <= 25)
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.global_ns) if "CastXML" in utils.xml_generator: found = [d for d in found if not d.is_artificial] self.assertTrue(len(found) != 35) elif "0.9" in utils.xml_generator: found = [d for d in found if not d.is_artificial] self.assertTrue(15 <= len(found) <= 21) else: self.assertTrue(19 <= len(found) <= 25)
def customize( self, mb ): matcher = ~declarations.namespace_matcher_t() matcher = matcher & declarations.regex_matcher_t( '.*skip.*' ) decls = mb.decls( matcher ) decls.ignore = True mb.build_code_creator( self.EXTENSION_NAME ) matcher = declarations.match_declaration_t( name='skip_a' ) found = code_creators.creator_finder.find_by_declaration( matcher , mb.code_creator.creators ) self.failUnless( not found, "'skip_a' declaration should not be exported" ) matcher = declarations.match_declaration_t( name='skip_b' ) found = code_creators.creator_finder.find_by_declaration( matcher , mb.code_creator.creators ) self.failUnless( not found, "'skip_b' declaration should not be exported" )
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.global_ns) if self.xml_generator_from_xml_file.is_castxml: found = [d for d in found if not d.is_artificial] self.assertTrue(len(found) != 35) elif self.xml_generator_from_xml_file.is_gccxml_09 or \ self.xml_generator_from_xml_file.is_gccxml_09_buggy: found = [d for d in found if not d.is_artificial] self.assertTrue(15 <= len(found) <= 21) else: self.assertTrue(19 <= len(found) <= 25)
def customize(self, mb): matcher = ~declarations.namespace_matcher_t() matcher = matcher & declarations.regex_matcher_t('.*skip.*') decls = mb.decls(matcher) decls.ignore = True mb.build_code_creator(self.EXTENSION_NAME) matcher = declarations.match_declaration_t(name='skip_a') found = code_creators.creator_finder.find_by_declaration( matcher, mb.code_creator.creators) self.assertTrue(not found, "'skip_a' declaration should not be exported") matcher = declarations.match_declaration_t(name='skip_b') found = code_creators.creator_finder.find_by_declaration( matcher, mb.code_creator.creators) self.assertTrue(not found, "'skip_b' declaration should not be exported")
def test_not_matcher(self): criteria1 = declarations.regex_matcher_t('oper.*', lambda decl: decl.name) found = declarations.matcher.find(~(~criteria1), self.global_ns) found = filter(lambda d: not d.is_artificial, found) self.failUnless(len(found) == 6)
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_regex(self): criteria = declarations.regex_matcher_t('oper.*', lambda decl: decl.name) operators = declarations.matcher.find(criteria, self.global_ns) operators = [d for d in operators if not d.is_artificial] self.assertTrue(6 == len(operators))
def test_not_matcher(self): criteria1 = declarations.regex_matcher_t('oper.*', lambda decl: decl.name) found = declarations.matcher.find(~(~criteria1), self.global_ns) found = [d for d in found if not d.is_artificial] self.assertTrue(len(found) == 6)
def test_regex(self): criteria = declarations.regex_matcher_t('oper.*', lambda decl: decl.name) operators = declarations.matcher.find(criteria, self.global_ns) operators = filter(lambda d: not d.is_artificial, operators) self.failUnless(6 == len(operators))
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 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 )