1-- C45265A.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-- CHECK THAT MEMBERSHIP TESTS YIELD THE CORRECT RESULTS FOR ONE
26-- DIMENSIONAL AND MULTI-DIMENSIONAL ARRAY TYPES WHEN:
27--     A) THE SUBTYPE INDICATION DENOTES AN UNCONSTRAINED ARRAY.
28--     B) THE SUBTYPE INDICATION DENOTES A CONSTRAINED ARRAY.
29
30-- TBN  7/22/86
31
32WITH REPORT; USE REPORT;
33PROCEDURE C45265A IS
34
35     PACKAGE P IS
36          TYPE KEY IS LIMITED PRIVATE;
37     PRIVATE
38          TYPE KEY IS NEW NATURAL;
39     END P;
40
41     SUBTYPE INT IS INTEGER RANGE 1 .. 20;
42     TYPE ARRAY_TYPE_1 IS ARRAY (INT RANGE <>) OF INTEGER;
43     TYPE ARRAY_TYPE_2 IS ARRAY (INT RANGE <>, INT RANGE <>) OF INTEGER;
44     TYPE ARRAY_TYPE_3 IS ARRAY (INT RANGE <>, INT RANGE <>,
45                                               INT RANGE <>) OF INTEGER;
46     TYPE ARRAY_TYPE_4 IS ARRAY (INT RANGE <>) OF P.KEY;
47     TYPE ARRAY_TYPE_5 IS ARRAY (INT RANGE <>, INT RANGE <>) OF P.KEY;
48
49     SUBTYPE ARRAY_SUB1 IS ARRAY_TYPE_1;
50     SUBTYPE ARRAY_SUB2 IS ARRAY_TYPE_2;
51     SUBTYPE ARRAY_SUB3 IS ARRAY_TYPE_3;
52     SUBTYPE ARRAY_SUB4 IS ARRAY_TYPE_4;
53     SUBTYPE ARRAY_SUB5 IS ARRAY_TYPE_5;
54     SUBTYPE CON_ARRAY1 IS ARRAY_TYPE_1 (1..5);
55     SUBTYPE CON_ARRAY2 IS ARRAY_TYPE_2 (1..2, 1..2);
56     SUBTYPE CON_ARRAY3 IS ARRAY_TYPE_3 (1..2, 1..3, 1..4);
57     SUBTYPE CON_ARRAY4 IS ARRAY_TYPE_4 (1..4);
58     SUBTYPE CON_ARRAY5 IS ARRAY_TYPE_5 (1..2, 1..3);
59     SUBTYPE NULL_ARRAY1 IS ARRAY_TYPE_1 (2 .. 1);
60
61     ARRAY1 : ARRAY_TYPE_1 (1..10);
62     ARRAY2 : ARRAY_SUB1 (11..20);
63     ARRAY3 : ARRAY_TYPE_2 (1..4, 1..3);
64     ARRAY4 : ARRAY_SUB2 (5..7, 5..8);
65     ARRAY5 : ARRAY_TYPE_3 (1..2, 1..3, 1..4);
66     ARRAY6 : ARRAY_SUB3 (1..3, 1..2, 1..4);
67     NULL_ARRAY_1 : ARRAY_TYPE_1 (3..2);
68     NULL_ARRAY_2 : ARRAY_SUB1 (2..1);
69     ARRAY7 : ARRAY_TYPE_1 (1..10) := (1..10 => 7);
70     ARRAY8 : CON_ARRAY1 := (1..5 => 8);
71     ARRAY9 : ARRAY_TYPE_2 (1..10, 1..10) := (1..10 => (1..10 => 9));
72     ARRAY10 : CON_ARRAY2 := (1..2 => (1..2 => 10));
73     ARRAY11 : ARRAY_TYPE_3 (1..10, 1..10, 1..10) := (1..10 =>
74                                              (1..10 => (1..10 => 11)));
75     ARRAY12 : CON_ARRAY3 := (1..2 => (1..3 => (1..4 => 12)));
76     ARRAY13 : ARRAY_TYPE_4 (1..2);
77     ARRAY14 : ARRAY_SUB4 (1..5);
78     ARRAY15 : ARRAY_TYPE_4 (1..6);
79     ARRAY16 : CON_ARRAY4;
80     ARRAY17 : ARRAY_TYPE_5 (1..3, 1..2);
81     ARRAY18 : ARRAY_SUB5 (1..2, 1..3);
82     ARRAY19 : ARRAY_TYPE_5 (1..4, 1..3);
83     ARRAY20 : CON_ARRAY5;
84
85BEGIN
86     TEST ("C45265A", "CHECK THAT MEMBERSHIP TESTS YIELD THE CORRECT " &
87                      "RESULTS FOR ONE DIMENSIONAL AND MULTI-" &
88                      "DIMENSIONAL ARRAY TYPES");
89
90     ARRAY1 := (ARRAY1'RANGE => 1);
91     ARRAY2 := (ARRAY2'RANGE => 2);
92     ARRAY3 := (ARRAY3'RANGE(1) => (ARRAY3'RANGE(2) => 3));
93     ARRAY4 := (ARRAY4'RANGE(1) => (ARRAY4'RANGE(2) => 4));
94     ARRAY5 := (ARRAY5'RANGE(1) => (ARRAY5'RANGE(2) =>
95                                   (ARRAY5'RANGE(3) => 5)));
96     ARRAY6 := (ARRAY6'RANGE(1) => (ARRAY6'RANGE(2) =>
97                                   (ARRAY6'RANGE(3) => 6)));
98
99     IF ARRAY1 IN ARRAY_SUB1 THEN
100          NULL;
101     ELSE
102          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 1");
103     END IF;
104     IF ARRAY2 NOT IN ARRAY_SUB1 THEN
105          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 2");
106     END IF;
107
108     IF ARRAY3 IN ARRAY_SUB2 THEN
109          NULL;
110     ELSE
111          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 3");
112     END IF;
113     IF ARRAY4 NOT IN ARRAY_SUB2 THEN
114          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 4");
115     END IF;
116
117     IF ARRAY5 IN ARRAY_SUB3 THEN
118          NULL;
119     ELSE
120          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 5");
121     END IF;
122     IF ARRAY6 NOT IN ARRAY_SUB3 THEN
123          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 6");
124     END IF;
125
126     IF NULL_ARRAY_1 IN ARRAY_SUB1 THEN
127          NULL;
128     ELSE
129          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 7");
130     END IF;
131     IF NULL_ARRAY_2 NOT IN ARRAY_SUB1 THEN
132          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 8");
133     END IF;
134
135     IF ARRAY7 IN CON_ARRAY1 THEN
136          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 9");
137     END IF;
138     IF ARRAY8 NOT IN CON_ARRAY1 THEN
139          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 10");
140     END IF;
141
142     IF ARRAY9 IN CON_ARRAY2 THEN
143          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 11");
144     END IF;
145     IF ARRAY10 NOT IN CON_ARRAY2 THEN
146          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 12");
147     END IF;
148
149     IF ARRAY11 IN CON_ARRAY3 THEN
150          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 13");
151     END IF;
152     IF ARRAY12 NOT IN CON_ARRAY3 THEN
153          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 14");
154     END IF;
155
156     IF ARRAY13 IN ARRAY_SUB4 THEN
157          NULL;
158     ELSE
159          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 15");
160     END IF;
161     IF ARRAY14 NOT IN ARRAY_SUB4 THEN
162          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 16");
163     END IF;
164
165     IF ARRAY15 IN CON_ARRAY4 THEN
166          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 17");
167     END IF;
168     IF ARRAY16 NOT IN CON_ARRAY4 THEN
169          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 18");
170     END IF;
171
172     IF ARRAY17 IN ARRAY_SUB5 THEN
173          NULL;
174     ELSE
175          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 19");
176     END IF;
177     IF ARRAY18 NOT IN ARRAY_SUB5 THEN
178          FAILED ("INCORRECT RESULTS FOR UNCONSTRAINED ARRAYS - 20");
179     END IF;
180
181     IF ARRAY19 IN CON_ARRAY5 THEN
182          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 21");
183     END IF;
184     IF ARRAY20 NOT IN CON_ARRAY5 THEN
185          FAILED ("INCORRECT RESULTS FOR CONSTRAINED ARRAYS - 22");
186     END IF;
187
188     IF NULL_ARRAY_1 IN NULL_ARRAY1 THEN
189          FAILED ("INCORRECT RESULTS FOR NULL ARRAYS - 23");
190     END IF;
191     IF NULL_ARRAY_2 NOT IN NULL_ARRAY1 THEN
192          FAILED ("INCORRECT RESULTS FOR NULL ARRAYS - 24");
193     END IF;
194
195     RESULT;
196END C45265A;
197