def test_free_funs(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") try: declarations.namespace_t().free_funs() except RuntimeError: pass self._check(w)
def test___lt__transitivnost(self): ns_std = declarations.namespace_t(name='std') ns_global = declarations.namespace_t(name='::') ns_internal = declarations.namespace_t(name='ns') ns_internal.parent = ns_global ns_global.declarations.append(ns_internal) left2right = [ns_std, ns_global] right2left = [ns_global, ns_std] left2right.sort() right2left.sort() self.failUnless(left2right == right2left, "bug: find me")
def test___lt__transitivnost(self): ns_std = declarations.namespace_t(name='std') ns_global = declarations.namespace_t(name='::') ns_internal = declarations.namespace_t(name='ns') ns_internal.parent = ns_global ns_global.declarations.append(ns_internal) left2right = [ns_std, ns_global] right2left = [ns_global, ns_std] left2right.sort() right2left.sort() self.assertTrue(left2right == right2left, "bug: find me")
def parse(self): xml_generator_config = parser.xml_generator_configuration_t(xml_generator_path=self.castxml_binary, xml_generator="castxml", cflags="-std=c++11", include_paths=self.source_includes) print ("INFO: Parsing Code") decls = parser.parse([self.wrapper_header_collection], xml_generator_config, compilation_mode=parser.COMPILATION_MODE.ALL_AT_ONCE) # Get access to the global namespace self.global_ns = declarations.get_global_namespace(decls) # Clean decls to only include those for which file locations exist print ("INFO: Cleaning Decls") query = declarations.custom_matcher_t(lambda decl: decl.location is not None) decls_loc_not_none = self.global_ns.decls(function=query) # Identify decls in our source tree def check_loc(loc): return (self.source_root in loc) or ("wrapper_header_collection" in loc) source_decls = [decl for decl in decls_loc_not_none if check_loc(decl.location.file_name)] self.source_ns = declarations.namespace_t("source", source_decls) print ("INFO: Optimizing Decls") self.source_ns.init_optimizer()