import source from 1.3.40
[external/swig.git] / Examples / test-suite / octave / contract_runme.m
1 contract
2
3 contract.test_preassert(1,2);
4 try
5         contract.test_preassert(-1,0)
6         error("Failed! Preassertions are broken")
7 catch
8 end_try_catch
9
10 contract.test_postassert(3);
11 try
12         contract.test_postassert(-3);
13         error("Failed! Postassertions are broken")
14 catch
15 end_try_catch
16
17 contract.test_prepost(2,3);
18 contract.test_prepost(5,-4);
19 try
20         contract.test_prepost(-3,4);
21         error("Failed! Preassertions are broken")
22 catch
23 end_try_catch
24
25 try
26         contract.test_prepost(4,-10);
27         error("Failed! Postassertions are broken")
28
29 catch
30 end_try_catch
31
32 f = contract.Foo();
33 f.test_preassert(4,5);
34 try
35         f.test_preassert(-2,3);
36         error("Failed! Method preassertion.")
37 catch
38 end_try_catch
39
40 f.test_postassert(4);
41 try
42         f.test_postassert(-4);
43         error("Failed! Method postassertion")
44 catch
45 end_try_catch
46
47 f.test_prepost(3,4);
48 f.test_prepost(4,-3);
49 try
50         f.test_prepost(-4,2);
51         error("Failed! Method preassertion.")
52 catch
53 end_try_catch
54
55 try
56         f.test_prepost(4,-10);
57         error("Failed! Method postassertion.")
58 catch
59 end_try_catch
60
61 contract.Foo_stest_prepost(4,0);
62 try
63         contract.Foo_stest_prepost(-4,2);
64         error("Failed! Static method preassertion")
65 catch
66 end_try_catch
67
68 try
69         contract.Foo_stest_prepost(4,-10);
70         error("Failed! Static method posteassertion")
71 catch
72 end_try_catch
73         
74 b = contract.Bar();
75 try
76         b.test_prepost(2,-4);
77         error("Failed! Inherited preassertion.")
78 catch
79 end_try_catch
80
81
82 d = contract.D();
83 try
84         d.foo(-1,1,1,1,1);
85         error("Failed! Inherited preassertion (D).")
86 catch
87 end_try_catch
88 try
89         d.foo(1,-1,1,1,1);
90         error("Failed! Inherited preassertion (D).")
91 catch
92 end_try_catch
93 try
94         d.foo(1,1,-1,1,1);
95         error("Failed! Inherited preassertion (D).")
96 catch
97 end_try_catch
98 try
99         d.foo(1,1,1,-1,1);
100         error("Failed! Inherited preassertion (D).")
101 catch
102 end_try_catch
103 try
104         d.foo(1,1,1,1,-1);
105         error("Failed! Inherited preassertion (D).")
106 catch
107 end_try_catch
108
109
110 try
111         d.bar(-1,1,1,1,1);
112         error("Failed! Inherited preassertion (D).")
113 catch
114 end_try_catch
115 try
116         d.bar(1,-1,1,1,1);
117         error("Failed! Inherited preassertion (D).")
118 catch
119 end_try_catch
120 try
121         d.bar(1,1,-1,1,1);
122         error("Failed! Inherited preassertion (D).")
123 catch
124 end_try_catch
125 try
126         d.bar(1,1,1,-1,1);
127         error("Failed! Inherited preassertion (D).")
128 catch
129 end_try_catch
130 try
131         d.bar(1,1,1,1,-1);
132         error("Failed! Inherited preassertion (D).")
133 catch
134 end_try_catch
135