3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
26 -- CHECK THAT THE REQUIRED PREDEFINED OPERATIONS ARE DECLARED
27 -- (IMPLICITLY) FOR DERIVED ACCESS TYPES WHOSE DESIGNATED TYPE IS A
28 -- MULTI-DIMENSIONAL ARRAY TYPE.
31 -- JRK 09/25/86 CREATED ORIGINAL TEST.
32 -- BCB 10/21/87 CHANGED HEADER TO STANDARD FORMAT. REVISED TEST SO
33 -- T'STORAGE_SIZE IS NOT REQUIRED TO BE > 1.
34 -- BCB 03/07/90 PUT CHECK FOR 'STORAGE_SIZE IN EXCEPTION HANDLER.
35 -- THS 09/18/90 REMOVED DECLARATION OF B, MADE THE BODY OF
36 -- PROCEDURE A NULL, AND DELETED ALL REFERENCES TO B.
37 -- PWN 01/31/95 REMOVED INCONSISTENCIES WITH ADA 9X.
39 WITH SYSTEM
; USE SYSTEM
;
40 WITH REPORT
; USE REPORT
;
44 SUBTYPE COMPONENT
IS INTEGER;
46 TYPE DESIGNATED
IS ARRAY (NATURAL RANGE <>, NATURAL RANGE <>) OF
49 SUBTYPE SUBDESIGNATED
IS DESIGNATED
50 (IDENT_INT
(4) .. IDENT_INT
(5),
51 IDENT_INT
(6) .. IDENT_INT
(8));
55 TYPE PARENT
IS ACCESS DESIGNATED
;
57 FUNCTION CREATE
( F1
, L1
: NATURAL;
60 DUMMY
: PARENT
-- TO RESOLVE OVERLOADING.
67 TYPE T
IS NEW PARENT
(IDENT_INT
(4) .. IDENT_INT
(5),
68 IDENT_INT
(6) .. IDENT_INT
(8));
70 X
: T
:= NEW SUBDESIGNATED
'(OTHERS => (OTHERS => 2));
71 Y : T := NEW SUBDESIGNATED'((1, 2, 3), (4, 5, 6));
72 W
: PARENT
:= NEW SUBDESIGNATED
'(OTHERS => (OTHERS => 2));
76 PROCEDURE A (X : ADDRESS) IS
81 FUNCTION V RETURN T IS
83 RETURN NEW SUBDESIGNATED'(OTHERS => (OTHERS => C
));
95 A
: PARENT
:= NEW DESIGNATED
(F1
.. L1
, F2
.. L2
);
98 FOR I
IN F1
.. L1
LOOP
99 FOR J
IN F2
.. L2
LOOP
109 FUNCTION IDENT
(X
: T
) RETURN T
IS
112 EQUAL
(X
'LENGTH, X
'LENGTH) THEN
113 RETURN X
; -- ALWAYS EXECUTED.
115 RETURN NEW SUBDESIGNATED
;
119 TEST
("C34007G", "CHECK THAT THE REQUIRED PREDEFINED OPERATIONS " &
120 "ARE DECLARED (IMPLICITLY) FOR DERIVED " &
121 "ACCESS TYPES WHOSE DESIGNATED TYPE IS A " &
122 "MULTI-DIMENSIONAL ARRAY TYPE");
124 IF Y
= NULL OR ELSE Y
.ALL /= ((1, 2, 3), (4, 5, 6)) THEN
125 FAILED
("INCORRECT INITIALIZATION");
130 FAILED
("INCORRECT :=");
134 FAILED ("INCORRECT QUALIFICATION");
138 FAILED ("INCORRECT SELF CONVERSION");
142 W := NEW SUBDESIGNATED'((1, 2, 3), (4, 5, 6));
145 IF X
= NULL OR ELSE X
= Y
OR ELSE
146 X
.ALL /= ((1, 2, 3), (4, 5, 6)) THEN
147 FAILED
("INCORRECT CONVERSION FROM PARENT");
152 IF W
= NULL OR ELSE W
.ALL /= ((1, 2, 3), (4, 5, 6)) OR ELSE
154 FAILED
("INCORRECT CONVERSION TO PARENT - 1");
157 W
:= PARENT
(CREATE
(6, 9, 2, 3, 4, X
));
159 W
.ALL /= ((4, 5), (6, 7), (8, 9), (10, 11)) THEN
160 FAILED
("INCORRECT CONVERSION TO PARENT - 2");
163 IF IDENT
(NULL) /= NULL OR X
= NULL THEN
164 FAILED
("INCORRECT NULL");
167 X
:= IDENT
(NEW SUBDESIGNATED
'((1, 2, 3), (4, 5, 6)));
168 IF (X = NULL OR ELSE X = Y OR ELSE
169 X.ALL /= ((1, 2, 3), (4, 5, 6))) OR
170 X = NEW DESIGNATED'((1, 2), (3, 4), (5, 6)) THEN
171 FAILED
("INCORRECT ALLOCATOR");
175 IF X
.ALL /= ((1, 2, 3), (4, 5, 6)) OR
176 CREATE
(6, 9, 2, 3, 4, X
) . ALL /=
177 ((4, 5), (6, 7), (8, 9), (10, 11)) THEN
178 FAILED
("INCORRECT .ALL (VALUE)");
181 X
.ALL := ((10, 11, 12), (13, 14, 15));
182 IF X
/= Y
OR Y
.ALL /= ((10, 11, 12), (13, 14, 15)) THEN
183 FAILED
("INCORRECT .ALL (ASSIGNMENT)");
186 Y
.ALL := ((1, 2, 3), (4, 5, 6));
188 CREATE
(6, 9, 2, 3, 4, X
) . ALL :=
189 ((20, 21), (22, 23), (24, 25), (26, 27));
192 FAILED
("EXCEPTION FOR .ALL (ASSIGNMENT)");
197 IF X
.ALL = ((0, 0, 0), (0, 0, 0)) THEN
198 FAILED
("NO EXCEPTION FOR NULL.ALL - 1");
199 ELSE FAILED
("NO EXCEPTION FOR NULL.ALL - 2");
202 WHEN CONSTRAINT_ERROR
=>
205 FAILED
("WRONG EXCEPTION FOR NULL.ALL");
209 IF X
(IDENT_INT
(4), IDENT_INT
(6)) /= 1 OR
210 CREATE
(6, 9, 2, 3, 4, X
) (9, 3) /= 11 THEN
211 FAILED
("INCORRECT INDEX (VALUE)");
214 X
(IDENT_INT
(5), IDENT_INT
(8)) := 7;
215 IF X
/= Y
OR Y
.ALL /= ((1, 2, 3), (4, 5, 7)) THEN
216 FAILED
("INCORRECT INDEX (ASSIGNMENT)");
219 Y
.ALL := ((1, 2, 3), (4, 5, 6));
222 CREATE
(6, 9, 2, 3, 4, X
) (6, 2) := 15;
225 FAILED
("EXCEPTION FOR INDEX (ASSIGNMENT)");
228 IF X
= NULL OR X
= NEW SUBDESIGNATED
OR NOT (X
= Y
) OR
229 X
= CREATE
(6, 9, 2, 3, 4, X
) THEN
230 FAILED
("INCORRECT =");
233 IF X
/= Y
OR NOT (X
/= NULL) OR
234 NOT (X
/= CREATE
(7, 9, 2, 4, 1, X
)) THEN
235 FAILED
("INCORRECT /=");
238 IF NOT (X
IN T
) OR CREATE
(2, 3, 4, 5, 1, X
) IN T
THEN
239 FAILED
("INCORRECT ""IN""");
242 IF X
NOT IN T
OR NOT (CREATE
(7, 9, 2, 4, 1, X
) NOT IN T
) THEN
243 FAILED
("INCORRECT ""NOT IN""");
249 FAILED
("INCORRECT OBJECT'FIRST");
253 FAILED
("INCORRECT VALUE'FIRST");
256 IF X
'FIRST (N
) /= 6 THEN
257 FAILED
("INCORRECT OBJECT'FIRST (N)");
260 IF V
'FIRST (N
) /= 6 THEN
261 FAILED
("INCORRECT VALUE'FIRST (N)");
265 FAILED
("INCORRECT OBJECT'LAST");
269 FAILED
("INCORRECT VALUE'LAST");
272 IF X
'LAST (N
) /= 8 THEN
273 FAILED
("INCORRECT OBJECT'LAST (N)");
276 IF V
'LAST (N
) /= 8 THEN
277 FAILED
("INCORRECT VALUE'LAST (N)");
280 IF X
'LENGTH /= 2 THEN
281 FAILED
("INCORRECT OBJECT'LENGTH");
284 IF V
'LENGTH /= 2 THEN
285 FAILED
("INCORRECT VALUE'LENGTH");
288 IF X
'LENGTH (N
) /= 3 THEN
289 FAILED
("INCORRECT OBJECT'LENGTH (N)");
292 IF V
'LENGTH (N
) /= 3 THEN
293 FAILED
("INCORRECT VALUE'LENGTH (N)");
297 Y
: DESIGNATED
(X
'RANGE, 1 .. 3);
299 IF Y
'FIRST /= 4 OR Y
'LAST /= 5 THEN
300 FAILED
("INCORRECT OBJECT'RANGE");
305 Y
: DESIGNATED
(V
'RANGE, 1 .. 3);
307 IF Y
'FIRST /= 4 OR Y
'LAST /= 5 THEN
308 FAILED
("INCORRECT VALUE'RANGE");
313 Y
: DESIGNATED
(1 .. 2, X
'RANGE (N
));
315 IF Y
'FIRST (N
) /= 6 OR Y
'LAST (N
) /= 8 THEN
316 FAILED
("INCORRECT OBJECT'RANGE (N)");
321 Y
: DESIGNATED
(1 .. 2, V
'RANGE (N
));
323 IF Y
'FIRST (N
) /= 6 OR Y
'LAST (N
) /= 8 THEN
324 FAILED
("INCORRECT VALUE'RANGE (N)");
329 FAILED
("INCORRECT TYPE'SIZE");
332 IF X
'SIZE < T
'SIZE THEN
333 FAILED
("INCORRECT OBJECT'SIZE");
337 IF T
'STORAGE_SIZE /= PARENT
'STORAGE_SIZE THEN
338 FAILED
("COLLECTION SIZE OF DERIVED TYPE IS NOT " &
339 "EQUAL TO COLLECTION SIZE OF PARENT TYPE");
342 WHEN PROGRAM_ERROR
=>
343 COMMENT
("PROGRAM_ERROR RAISED FOR " &
344 "UNDEFINED STORAGE_SIZE (AI-00608)");
346 FAILED
("UNEXPECTED EXCEPTION RAISED");