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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
-- C74004A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT OPERATIONS DEPENDING ON THE FULL DECLARATION OF A
-- PRIVATE TYPE ARE AVAILABLE WITHIN THE PACKAGE BODY.
-- HISTORY:
-- BCB 04/05/88 CREATED ORIGINAL TEST.
-- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
WITH REPORT; USE REPORT;
PROCEDURE C74004A IS
PACKAGE P IS
TYPE PR IS PRIVATE;
TYPE ARR1 IS LIMITED PRIVATE;
TYPE ARR2 IS PRIVATE;
TYPE REC (D : INTEGER) IS PRIVATE;
TYPE ACC IS PRIVATE;
TYPE TSK IS LIMITED PRIVATE;
TYPE FLT IS LIMITED PRIVATE;
TYPE FIX IS LIMITED PRIVATE;
TASK TYPE T IS
ENTRY ONE(V : IN OUT INTEGER);
END T;
PROCEDURE CHECK (V : ARR2);
PRIVATE
TYPE PR IS NEW INTEGER;
TYPE ARR1 IS ARRAY(1..5) OF INTEGER;
TYPE ARR2 IS ARRAY(1..5) OF BOOLEAN;
TYPE REC (D : INTEGER) IS RECORD
COMP1 : INTEGER;
COMP2 : BOOLEAN;
END RECORD;
TYPE ACC IS ACCESS INTEGER;
TYPE TSK IS NEW T;
TYPE FLT IS DIGITS 5;
TYPE FIX IS DELTA 2.0**(-1) RANGE -100.0 .. 100.0;
END P;
PACKAGE BODY P IS
X1, X2, X3 : PR;
BOOL : BOOLEAN := IDENT_BOOL(FALSE);
VAL : INTEGER := IDENT_INT(0);
FVAL : FLOAT := 0.0;
ST : STRING(1..2);
O1 : ARR1 := (1,2,3,4,5);
Y1 : ARR2 := (FALSE,TRUE,FALSE,TRUE,FALSE);
Y2 : ARR2 := (OTHERS => TRUE);
Y3 : ARR2 := (OTHERS => FALSE);
Z1 : REC(0) := (0,1,FALSE);
W1, W2 : ACC := NEW INTEGER'(0);
V1 : TSK;
TASK BODY T IS
BEGIN
ACCEPT ONE(V : IN OUT INTEGER) DO
V := IDENT_INT(10);
END ONE;
END T;
PROCEDURE CHECK (V : ARR2) IS
BEGIN
IF V /= (TRUE,FALSE,TRUE,FALSE,TRUE) THEN
FAILED ("IMPROPER VALUE PASSED AS AGGREGATE");
END IF;
END CHECK;
BEGIN
TEST ("C74004A", "CHECK THAT OPERATIONS DEPENDING ON THE " &
"FULL DECLARATION OF A PRIVATE TYPE ARE " &
"AVAILABLE WITHIN THE PACKAGE BODY");
X1 := 10;
X2 := 5;
X3 := X1 + X2;
IF X3 /= 15 THEN
FAILED ("IMPROPER RESULT FROM ADDITION OPERATOR");
END IF;
X3 := X1 - X2;
IF X3 /= 5 THEN
FAILED ("IMPROPER RESULT FROM SUBTRACTION OPERATOR");
END IF;
X3 := X1 * X2;
IF X3 /= 50 THEN
FAILED ("IMPROPER RESULT FROM MULTIPLICATION OPERATOR");
END IF;
X3 := X1 / X2;
IF X3 /= 2 THEN
FAILED ("IMPROPER RESULT FROM DIVISION OPERATOR");
END IF;
X3 := X1 ** 2;
IF X3 /= 100 THEN
FAILED ("IMPROPER RESULT FROM EXPONENTIATION OPERATOR");
END IF;
BOOL := X1 < X2;
IF BOOL THEN
FAILED ("IMPROPER RESULT FROM LESS THAN OPERATOR");
END IF;
BOOL := X1 > X2;
IF NOT BOOL THEN
FAILED ("IMPROPER RESULT FROM GREATER THAN OPERATOR");
END IF;
BOOL := X1 <= X2;
IF BOOL THEN
FAILED ("IMPROPER RESULT FROM LESS THAN OR EQUAL TO " &
"OPERATOR");
END IF;
BOOL := X1 >= X2;
IF NOT BOOL THEN
FAILED ("IMPROPER RESULT FROM GREATER THAN OR EQUAL " &
"TO OPERATOR");
END IF;
X3 := X1 MOD X2;
IF X3 /= 0 THEN
FAILED ("IMPROPER RESULT FROM MOD OPERATOR");
END IF;
X3 := X1 REM X2;
IF X3 /= 0 THEN
FAILED ("IMPROPER RESULT FROM REM OPERATOR");
END IF;
X3 := ABS(X1);
IF X3 /= 10 THEN
FAILED ("IMPROPER RESULT FROM ABS OPERATOR - 1");
END IF;
X1 := -10;
X3 := ABS(X1);
IF X3 /= 10 THEN
FAILED ("IMPROPER RESULT FROM ABS OPERATOR - 2");
END IF;
X3 := PR'BASE'FIRST;
IF X3 /= PR(INTEGER'FIRST) THEN
FAILED ("IMPROPER RESULT FROM 'BASE'FIRST");
END IF;
X3 := PR'FIRST;
IF X3 /= PR(INTEGER'FIRST) THEN
FAILED ("IMPROPER RESULT FROM 'FIRST");
END IF;
VAL := PR'WIDTH;
IF NOT EQUAL(VAL,INTEGER'WIDTH) THEN
FAILED ("IMPROPER RESULT FROM 'WIDTH");
END IF;
VAL := PR'POS(X3);
IF NOT EQUAL(VAL,INTEGER'FIRST) THEN
FAILED ("IMPROPER RESULT FROM 'POS");
END IF;
X3 := PR'VAL(VAL);
IF X3 /= PR(INTEGER'FIRST) THEN
FAILED ("IMPROPER RESULT FROM 'VAL");
END IF;
X3 := PR'SUCC(X2);
IF X3 /= 6 THEN
FAILED ("IMPROPER RESULT FROM 'SUCC");
END IF;
X3 := PR'PRED(X2);
IF X3 /= 4 THEN
FAILED ("IMPROPER RESULT FROM 'PRED");
END IF;
ST := PR'IMAGE(X3);
IF ST /= INTEGER'IMAGE(INTEGER(X3)) THEN
FAILED ("IMPROPER RESULT FROM 'IMAGE");
END IF;
X3 := PR'VALUE(ST);
IF X3 /= PR(INTEGER'VALUE(ST)) THEN
FAILED ("IMPROPER RESULT FROM 'VALUE");
END IF;
CHECK ((TRUE,FALSE,TRUE,FALSE,TRUE));
IF O1(2) /= IDENT_INT(2) THEN
FAILED ("IMPROPER VALUE FROM INDEXING");
END IF;
IF O1(2..4) /= (2,3,4) THEN
FAILED ("IMPROPER VALUES FROM SLICING");
END IF;
IF VAL IN O1'RANGE THEN
FAILED ("IMPROPER RESULT FROM 'RANGE");
END IF;
VAL := O1'LENGTH;
IF NOT EQUAL(VAL,5) THEN
FAILED ("IMPROPER RESULT FROM 'LENGTH");
END IF;
Y3 := Y1(1..2) & Y2(3..5);
IF Y3 /= (FALSE,TRUE,TRUE,TRUE,TRUE) THEN
FAILED ("IMPROPER RESULT FROM CATENATION");
END IF;
Y3 := NOT Y1;
IF Y3 /= (TRUE,FALSE,TRUE,FALSE,TRUE) THEN
FAILED ("IMPROPER RESULT FROM NOT OPERATOR");
END IF;
Y3 := Y1 AND Y2;
IF Y3 /= (FALSE,TRUE,FALSE,TRUE,FALSE) THEN
FAILED ("IMPROPER RESULT FROM AND OPERATOR");
END IF;
Y3 := Y1 OR Y2;
IF Y3 /= (TRUE,TRUE,TRUE,TRUE,TRUE) THEN
FAILED ("IMPROPER RESULT FROM OR OPERATOR");
END IF;
Y3 := Y1 XOR Y2;
IF Y3 /= (TRUE,FALSE,TRUE,FALSE,TRUE) THEN
FAILED ("IMPROPER RESULT FROM XOR OPERATOR");
END IF;
VAL := Z1.COMP1;
IF NOT EQUAL(VAL,1) THEN
FAILED ("IMPROPER RESULT FROM SELECTION OF RECORD " &
"COMPONENTS");
END IF;
W1 := NEW INTEGER'(0);
IF NOT EQUAL(W1.ALL,0) THEN
FAILED ("IMPROPER RESULT FROM ALLOCATION");
END IF;
W1 := NULL;
IF W1 /= NULL THEN
FAILED ("IMPROPER RESULT FROM NULL LITERAL");
END IF;
VAL := W2.ALL;
IF NOT EQUAL(VAL,0) THEN
FAILED ("IMPROPER RESULT FROM SELECTED COMPONENT");
END IF;
BOOL := V1'CALLABLE;
IF NOT BOOL THEN
FAILED ("IMPROPER RESULT FROM 'CALLABLE");
END IF;
BOOL := V1'TERMINATED;
IF BOOL THEN
FAILED ("IMPROPER RESULT FROM 'TERMINATED");
END IF;
V1.ONE(VAL);
IF NOT EQUAL(VAL,10) THEN
FAILED ("IMPROPER RESULT RETURNED FROM ENTRY SELECTION");
END IF;
IF NOT (FLT(1.0) IN FLT) THEN
FAILED ("IMPROPER RESULT FROM IMPLICIT CONVERSION");
END IF;
VAL := FLT'DIGITS;
IF NOT EQUAL(VAL,5) THEN
FAILED ("IMPROPER RESULT FROM 'DIGITS");
END IF;
BOOL := FLT'MACHINE_ROUNDS;
BOOL := FLT'MACHINE_OVERFLOWS;
VAL := FLT'MACHINE_RADIX;
VAL := FLT'MACHINE_MANTISSA;
VAL := FLT'MACHINE_EMAX;
VAL := FLT'MACHINE_EMIN;
FVAL := FIX'DELTA;
IF FVAL /= 2.0**(-1) THEN
FAILED ("IMPROPER RESULT FROM 'DELTA");
END IF;
VAL := FIX'FORE;
VAL := FIX'AFT;
END P;
USE P;
BEGIN
RESULT;
END C74004A;
|