1-- C43204A.ADA
2
3--                             Grant of Unlimited Rights
4--
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
14--     to do so.
15--
16--                                    DISCLAIMER
17--
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.
24--*
25-- OBJECTIVE:
26--     CHECK THAT AN ARRAY AGGREGATE WITH AN OTHERS CHOICE CAN APPEAR
27--     (AND BOUNDS ARE DETERMINED CORRECTLY) AS AN ACTUAL PARAMETER OF
28--     A SUBPROGRAM CALL WHEN THE FORMAL PARAMETER IS CONSTRAINED.
29
30-- HISTORY:
31--     JET 08/04/88  CREATED ORIGINAL TEST.
32
33WITH REPORT; USE REPORT;
34PROCEDURE C43204A IS
35
36     TYPE ARR10 IS ARRAY(IDENT_INT(1)..IDENT_INT(0)) OF INTEGER;
37     TYPE ARR11 IS ARRAY(INTEGER RANGE -3..3) OF INTEGER;
38     TYPE ARR12 IS ARRAY(IDENT_INT(-3)..IDENT_INT(3)) OF INTEGER;
39
40     TYPE ARR20 IS ARRAY(IDENT_INT(1)..IDENT_INT(0),
41                         IDENT_INT(0)..IDENT_INT(-1)) OF INTEGER;
42     TYPE ARR21 IS ARRAY(INTEGER RANGE -1..1,
43                         INTEGER RANGE -1..1) OF INTEGER;
44     TYPE ARR22 IS ARRAY(IDENT_INT(-1)..IDENT_INT(1),
45                         IDENT_INT(-1)..IDENT_INT(1)) OF INTEGER;
46     TYPE ARR23 IS ARRAY(INTEGER'(-1)..1,
47                         IDENT_INT(-1)..IDENT_INT(1)) OF INTEGER;
48
49     PROCEDURE PROC10 (A : ARR10) IS
50     BEGIN
51          IF A'LENGTH /= IDENT_INT(0) THEN
52               FAILED ("PROC10 ARRAY IS NOT NULL");
53          END IF;
54     END PROC10;
55
56     PROCEDURE PROC11 (A : ARR11; C : INTEGER) IS
57     BEGIN
58          IF A'LENGTH /= IDENT_INT(7) OR
59             A'FIRST /= IDENT_INT(-3) OR
60             A'LAST /= IDENT_INT(3)   THEN
61               FAILED ("INCORRECT LENGTH IN PROC11 CALL NUMBER" &
62                       INTEGER'IMAGE(C));
63          END IF;
64
65          FOR I IN IDENT_INT(-3)..IDENT_INT(3) LOOP
66               IF IDENT_INT(A(I)) /= C THEN
67                    FAILED ("INCORRECT VALUE OF COMPONENT " &
68                            INTEGER'IMAGE(I) & ", PROC11 CALL NUMBER" &
69                            INTEGER'IMAGE(C));
70               END IF;
71          END LOOP;
72     END PROC11;
73
74     PROCEDURE PROC12 (A : ARR12) IS
75     BEGIN
76          IF A'LENGTH /= IDENT_INT(7) THEN
77               FAILED ("INCORRECT LENGTH IN PROC12");
78          END IF;
79
80          FOR I IN IDENT_INT(-3)..IDENT_INT(3) LOOP
81               IF IDENT_INT(A(I)) /= 3 THEN
82                    FAILED ("INCORRECT VALUE OF COMPONENT " &
83                            INTEGER'IMAGE(I) & ", PROC12");
84               END IF;
85          END LOOP;
86     END PROC12;
87
88     PROCEDURE PROC20 (A : ARR20) IS
89     BEGIN
90          IF A'LENGTH(1) /= IDENT_INT(0) OR
91             A'LENGTH(2) /= IDENT_INT(0) THEN
92               FAILED ("PROC20 ARRAY IS NOT NULL");
93          END IF;
94     END PROC20;
95
96     PROCEDURE PROC21 (A : ARR21; C : INTEGER) IS
97     BEGIN
98          FOR I IN INTEGER'(-1)..1 LOOP
99               FOR J IN INTEGER'(-1)..1 LOOP
100                    IF IDENT_INT(A(I,J)) /= C THEN
101                         FAILED ("INCORRECT VALUE OF COMPONENT (" &
102                                 INTEGER'IMAGE(I) & "," &
103                                 INTEGER'IMAGE(J) & "), PROC21 CALL " &
104                                 "NUMBER" & INTEGER'IMAGE(C));
105                    END IF;
106               END LOOP;
107          END LOOP;
108     END PROC21;
109
110     PROCEDURE PROC22 (A : ARR22) IS
111     BEGIN
112          FOR I IN INTEGER'(-1)..1 LOOP
113               FOR J IN INTEGER'(-1)..1 LOOP
114                    IF IDENT_INT(A(I,J)) /= 5 THEN
115                         FAILED ("INCORRECT VALUE OF COMPONENT (" &
116                                 INTEGER'IMAGE(I) & "," &
117                                 INTEGER'IMAGE(J) & "), PROC22");
118                    END IF;
119               END LOOP;
120          END LOOP;
121     END PROC22;
122
123     PROCEDURE PROC23 (A : ARR23) IS
124     BEGIN
125          FOR I IN INTEGER'(-1)..1 LOOP
126               FOR J IN INTEGER'(-1)..1 LOOP
127                    IF IDENT_INT(A(I,J)) /= 7 THEN
128                         FAILED ("INCORRECT VALUE OF COMPONENT (" &
129                                 INTEGER'IMAGE(I) & "," &
130                                 INTEGER'IMAGE(J) & "), PROC23");
131                    END IF;
132               END LOOP;
133          END LOOP;
134     END PROC23;
135
136BEGIN
137     TEST ("C43204A", "CHECK THAT AN ARRAY AGGREGATE WITH AN OTHERS " &
138                      "CHOICE CAN APPEAR (AND BOUNDS ARE DETERMINED " &
139                      "CORRECTLY) AS AN ACTUAL PARAMETER OF A " &
140                      "SUBPROGRAM CALL WHEN THE FORMAL PARAMETER IS " &
141                      "CONSTRAINED");
142
143     PROC11 ((1,1,1, OTHERS => 1), 1);
144     PROC11 ((2 => 2, 3 => 2, OTHERS => 2), 2);
145     PROC12 ((OTHERS => 3));
146     PROC10 ((OTHERS => 4));
147
148     PROC21 (((1,1,1), OTHERS => (1,1,1)), 1);
149     PROC21 ((1 => (2,2,2), OTHERS => (2,2,2)), 2);
150     PROC21 (((3,OTHERS => 3), (3,OTHERS => 3), (3,3,OTHERS => 3)), 3);
151     PROC21 (((-1 => 4, OTHERS => 4), (0 => 4, OTHERS => 4),
152              (1 => 4, OTHERS => 4)), 4);
153     PROC22 ((OTHERS => (OTHERS => 5)));
154     PROC20 ((OTHERS => (OTHERS => 6)));
155     PROC23 ((OTHERS => (7,7,7)));
156
157     RESULT;
158END C43204A;
159