File: minherit_runme.py

package info (click to toggle)
swig2.0 2.0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 31,452 kB
  • ctags: 15,278
  • sloc: cpp: 50,112; ansic: 25,628; java: 8,829; python: 6,834; cs: 5,845; yacc: 5,199; makefile: 5,143; sh: 5,068; ruby: 3,683; perl: 2,389; lisp: 1,807; php: 1,701; tcl: 968; ml: 619; xml: 115
file content (71 lines) | stat: -rw-r--r-- 2,273 bytes parent folder | download | duplicates (12)
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

import minherit

a = minherit.Foo()
b = minherit.Bar()
c = minherit.FooBar()
d = minherit.Spam()

if a.xget() != 1:
    raise RuntimeError, "Bad attribute value"

if b.yget() != 2:
    raise RuntimeError, "Bad attribute value"    

if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
    raise RuntimeError, "Bad attribute value"    

if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
    raise RuntimeError, "Bad attribute value"        


if minherit.xget(a) != 1:
    raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))     

if minherit.yget(b) != 2:
    raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b)) 

if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
    raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(c), minherit.yget(c), minherit.zget(c))    

if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
    raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))

# Cleanse all of the pointers and see what happens

aa = minherit.toFooPtr(a)
bb = minherit.toBarPtr(b)
cc = minherit.toFooBarPtr(c)
dd = minherit.toSpamPtr(d)

if aa.xget() != 1:
    raise RuntimeError, "Bad attribute value"

if bb.yget() != 2:
    raise RuntimeError, "Bad attribute value"    

if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
    raise RuntimeError, "Bad attribute value"    

if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
    raise RuntimeError, "Bad attribute value"        

if minherit.xget(aa) != 1:
    raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))     

if minherit.yget(bb) != 2:
    raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb)) 

if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
    raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))    

if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
    raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))