File: director_basic_runme.py

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (93 lines) | stat: -rw-r--r-- 1,529 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import director_basic


class PyFoo(director_basic.Foo):

    def ping(self):
        return "PyFoo::ping()"


a = PyFoo()

if a.ping() != "PyFoo::ping()":
    raise RuntimeError, a.ping()

if a.pong() != "Foo::pong();PyFoo::ping()":
    raise RuntimeError, a.pong()

b = director_basic.Foo()

if b.ping() != "Foo::ping()":
    raise RuntimeError, b.ping()

if b.pong() != "Foo::pong();Foo::ping()":
    raise RuntimeError, b.pong()

a = director_basic.A1(1)

if a.rg(2) != 2:
    raise RuntimeError


class PyClass(director_basic.MyClass):

    def method(self, vptr):
        self.cmethod = 7
        pass

    def vmethod(self, b):
        b.x = b.x + 31
        return b


b = director_basic.Bar(3)
d = director_basic.MyClass()
c = PyClass()

cc = director_basic.MyClass_get_self(c)
dd = director_basic.MyClass_get_self(d)

bc = cc.cmethod(b)
bd = dd.cmethod(b)

cc.method(b)
if c.cmethod != 7:
    raise RuntimeError

if bc.x != 34:
    raise RuntimeError


if bd.x != 16:
    raise RuntimeError


class PyMulti(director_basic.Foo, director_basic.MyClass):

    def __init__(self):
        director_basic.Foo.__init__(self)
        director_basic.MyClass.__init__(self)
        pass

    def vmethod(self, b):
        b.x = b.x + 31
        return b

    def ping(self):
        return "PyFoo::ping()"

a = 0
for i in range(0, 100):
    pymult = PyMulti()
    pymult.pong()
    del pymult


pymult = PyMulti()


p1 = director_basic.Foo_get_self(pymult)
p2 = director_basic.MyClass_get_self(pymult)

p1.ping()
p2.vmethod(bc)