1
|
package com.goldencode.testcases;
|
2
|
|
3
|
import com.goldencode.p2j.util.*;
|
4
|
import com.goldencode.p2j.ui.*;
|
5
|
|
6
|
import static com.goldencode.p2j.util.BlockManager.*;
|
7
|
import static com.goldencode.p2j.util.ArrayAssigner.*;
|
8
|
import static com.goldencode.p2j.util.CompareOps.*;
|
9
|
import static com.goldencode.p2j.ui.LogicalTerminal.*;
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
public class SilentError
|
16
|
{
|
17
|
integer[] i1 = new integer[2];
|
18
|
|
19
|
integer[] i2 = new integer[2];
|
20
|
|
21
|
integer[] i3 = new integer[2];
|
22
|
|
23
|
integer[] i4 = new integer[2];
|
24
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
public void execute()
|
30
|
{
|
31
|
externalProcedure(new Block()
|
32
|
{
|
33
|
public void init()
|
34
|
{
|
35
|
assignMulti(i1, new integer(0));
|
36
|
TransactionManager.register((Object) i1, (Object) i2, (Object) i3, (Object) i4);
|
37
|
assignMulti(i2, new integer(0));
|
38
|
assignMulti(i3, new integer(0));
|
39
|
assignMulti(i4, new integer(0));
|
40
|
}
|
41
|
|
42
|
public void body()
|
43
|
{
|
44
|
ErrorManager.silentErrorEnable();
|
45
|
ControlFlowOps.invokeWithMode("proc1", "U", new ExtentExpr0());
|
46
|
ErrorManager.silentErrorDisable();
|
47
|
if (_isNotEqual(i1.length, 2))
|
48
|
{
|
49
|
message("ERR i1 <> 2");
|
50
|
}
|
51
|
message("This is expected");
|
52
|
ControlFlowOps.invokeWithMode("proc2", "U", new ExtentExpr1());
|
53
|
if (_isNotEqual(i2.length, 2))
|
54
|
{
|
55
|
message("ERR i2 <> 2");
|
56
|
}
|
57
|
message("This is expected");
|
58
|
ErrorManager.silentErrorEnable();
|
59
|
ControlFlowOps.invokeWithMode("proc3", "O", new ExtentExpr2());
|
60
|
ErrorManager.silentErrorDisable();
|
61
|
if (_isNotEqual(i3.length, 2))
|
62
|
{
|
63
|
message("ERR i3 <> 2");
|
64
|
}
|
65
|
message("This is expected");
|
66
|
ControlFlowOps.invokeWithMode("proc4", "O", new ExtentExpr3());
|
67
|
message("This is unexpected.");
|
68
|
}
|
69
|
});
|
70
|
}
|
71
|
|
72
|
public void proc1(final InputOutputExtentParameter<integer> extp)
|
73
|
{
|
74
|
internalProcedure(new Block()
|
75
|
{
|
76
|
integer[] p = extp.initParameter();
|
77
|
|
78
|
public void init()
|
79
|
{
|
80
|
TransactionManager.registerUndo(p);
|
81
|
}
|
82
|
|
83
|
public void body()
|
84
|
{
|
85
|
if (_isNotEqual(ArrayAssigner.lengthOf(p), 2))
|
86
|
{
|
87
|
message("ERR (proc1) p <> 2");
|
88
|
}
|
89
|
message("INF (proc1) Expect to get continue-error 'Indeterminate extent is already fixed to a dimension of 2. (13738)'");
|
90
|
p = ArrayAssigner.resize(p, 3);
|
91
|
message("INF (proc1) This is unexpected");
|
92
|
}
|
93
|
});
|
94
|
}
|
95
|
|
96
|
public void proc2(final InputOutputExtentParameter<integer> extp)
|
97
|
{
|
98
|
internalProcedure(new Block()
|
99
|
{
|
100
|
integer[] p = extp.initParameter();
|
101
|
|
102
|
public void init()
|
103
|
{
|
104
|
TransactionManager.registerUndo(p);
|
105
|
}
|
106
|
|
107
|
public void body()
|
108
|
{
|
109
|
if (_isNotEqual(ArrayAssigner.lengthOf(p), 2))
|
110
|
{
|
111
|
message("ERR (proc2) p <> 2");
|
112
|
}
|
113
|
message("INF (proc2) Expect to get continue-error 'Indeterminate extent is already fixed to a dimension of 2. (13738)'");
|
114
|
p = ArrayAssigner.resize(p, 3);
|
115
|
message("INF (proc2) This is unexpected");
|
116
|
}
|
117
|
});
|
118
|
}
|
119
|
|
120
|
public void proc3(final OutputExtentParameter<integer> extp)
|
121
|
{
|
122
|
internalProcedure(new Block()
|
123
|
{
|
124
|
integer[] p = extp.initParameter();
|
125
|
|
126
|
public void init()
|
127
|
{
|
128
|
assignMulti(p, new integer(0));
|
129
|
TransactionManager.registerUndo(p);
|
130
|
}
|
131
|
|
132
|
public void body()
|
133
|
{
|
134
|
if (_notUnknown(ArrayAssigner.lengthOf(p)))
|
135
|
{
|
136
|
message("ERR (proc3) p <> ?");
|
137
|
}
|
138
|
p = ArrayAssigner.resize(p, 3);
|
139
|
if (_isNotEqual(ArrayAssigner.lengthOf(p), 3))
|
140
|
{
|
141
|
message("ERR (proc3) p <> 3");
|
142
|
}
|
143
|
message("INF (proc3) Expect to get continue-error 'Extent parameter dimension of 2 from procedure...'");
|
144
|
}
|
145
|
});
|
146
|
}
|
147
|
|
148
|
public void proc4(final OutputExtentParameter<integer> extp)
|
149
|
{
|
150
|
internalProcedure(new Block()
|
151
|
{
|
152
|
integer[] p = extp.initParameter();
|
153
|
|
154
|
public void init()
|
155
|
{
|
156
|
assignMulti(p, new integer(0));
|
157
|
TransactionManager.registerUndo(p);
|
158
|
}
|
159
|
|
160
|
public void body()
|
161
|
{
|
162
|
if (_notUnknown(ArrayAssigner.lengthOf(p)))
|
163
|
{
|
164
|
message("ERR (proc4) p <> ?");
|
165
|
}
|
166
|
p = ArrayAssigner.resize(p, 3);
|
167
|
if (_isNotEqual(ArrayAssigner.lengthOf(p), 3))
|
168
|
{
|
169
|
message("ERR (proc4) p <> 3");
|
170
|
}
|
171
|
message("INF (proc4) Expect to get continue-error 'Extent parameter dimension of 2 from procedure...'");
|
172
|
}
|
173
|
});
|
174
|
}
|
175
|
|
176
|
private class ExtentExpr0
|
177
|
extends InputOutputExtentParameter<integer>
|
178
|
{
|
179
|
public integer[] getVariable()
|
180
|
{
|
181
|
return i1;
|
182
|
}
|
183
|
|
184
|
public void setVariable(final integer[] newRef)
|
185
|
{
|
186
|
i1 = newRef;
|
187
|
}
|
188
|
}
|
189
|
|
190
|
private class ExtentExpr1
|
191
|
extends InputOutputExtentParameter<integer>
|
192
|
{
|
193
|
public integer[] getVariable()
|
194
|
{
|
195
|
return i2;
|
196
|
}
|
197
|
|
198
|
public void setVariable(final integer[] newRef)
|
199
|
{
|
200
|
i2 = newRef;
|
201
|
}
|
202
|
}
|
203
|
|
204
|
private class ExtentExpr2
|
205
|
extends OutputExtentParameter<integer>
|
206
|
{
|
207
|
public integer[] getVariable()
|
208
|
{
|
209
|
return i3;
|
210
|
}
|
211
|
|
212
|
public void setVariable(final integer[] newRef)
|
213
|
{
|
214
|
i3 = newRef;
|
215
|
}
|
216
|
}
|
217
|
|
218
|
private class ExtentExpr3
|
219
|
extends OutputExtentParameter<integer>
|
220
|
{
|
221
|
public integer[] getVariable()
|
222
|
{
|
223
|
return i4;
|
224
|
}
|
225
|
|
226
|
public void setVariable(final integer[] newRef)
|
227
|
{
|
228
|
i4 = newRef;
|
229
|
}
|
230
|
}
|
231
|
}
|