Пример #1
0
 def f():
     lib = interp_cppyy.load_dictionary(space, "./example01Dict.so")
     cls  = interp_cppyy.scope_byname(space, "example01")
     inst = cls.get_overload("example01").call(None, [FakeInt(0)])
     cppmethod = cls.get_overload(method_name)
     assert isinstance(inst, interp_cppyy.W_CPPInstance)
     i = 10
     while i > 0:
         drv.jit_merge_point(inst=inst, cppmethod=cppmethod, i=i)
         cppmethod.call(inst, [FakeInt(i)])
         i -= 1
     return 7
Пример #2
0
 def test01_class_query(self):
     # NOTE: this test needs to run before test_pythonify.py
     dct = interp_cppyy.load_dictionary(space, test_dct)
     w_cppyyclass = interp_cppyy.scope_byname(space, "example01")
     w_cppyyclass2 = interp_cppyy.scope_byname(space, "example01")
     assert space.is_w(w_cppyyclass, w_cppyyclass2)
     adddouble = w_cppyyclass.methods["staticAddToDouble"]
     func, = adddouble.functions
     assert func.executor is None
     func._setup(None)     # creates executor
     assert isinstance(func.executor, executor.DoubleExecutor)
     assert func.arg_defs == [("double", "")]
Пример #3
0
 def f():
     lib = interp_cppyy.load_dictionary(space, "./example01Dict.so")
     cls  = interp_cppyy.scope_byname(space, "example01")
     inst = cls.get_overload("example01").call(None, [FakeInt(0)])
     cppmethod = cls.get_overload(method_name)
     assert isinstance(inst, interp_cppyy.W_CPPInstance)
     i = 10
     while i > 0:
         drv.jit_merge_point(inst=inst, cppmethod=cppmethod, i=i)
         cppmethod.call(inst, [FakeInt(i)])
         i -= 1
     return 7
Пример #4
0
 def test01_class_query(self, space):
     # NOTE: this test needs to run before test_pythonify.py
     dct = interp_cppyy.load_dictionary(space, test_dct)
     w_cppyyclass = interp_cppyy.scope_byname(space, "example01")
     w_cppyyclass2 = interp_cppyy.scope_byname(space, "example01")
     assert space.is_w(w_cppyyclass, w_cppyyclass2)
     adddouble = w_cppyyclass.methods["staticAddToDouble"]
     func, = adddouble.functions
     assert func.executor is None
     func._setup(None)  # creates executor
     assert isinstance(func.executor, executor._executors['double'])
     assert func.arg_defs == [("double", "")]