1 |
720 |
jeremybenn |
-- C52103P.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 LENGTHS MUST MATCH IN ARRAY AND SLICE ASSIGNMENTS.
|
26 |
|
|
-- MORE SPECIFICALLY, TEST THAT ARRAY ASSIGNMENTS WITH MATCHING
|
27 |
|
|
-- LENGTHS DO NOT CAUSE CONSTRAINT_ERROR TO BE RAISED AND
|
28 |
|
|
-- ARE PERFORMED CORRECTLY.
|
29 |
|
|
-- (OVERLAPS BETWEEN THE OPERANDS OF THE ASSIGNMENT STATEMENT
|
30 |
|
|
-- ARE TREATED ELSEWHERE.)
|
31 |
|
|
|
32 |
|
|
-- DIVISION D : NULL LENGTHS NOT DETERMINABLE STATICALLY.
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
-- RM 07/20/81
|
36 |
|
|
-- SPS 3/22/83
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
WITH REPORT;
|
40 |
|
|
PROCEDURE C52103P IS
|
41 |
|
|
|
42 |
|
|
USE REPORT ;
|
43 |
|
|
|
44 |
|
|
BEGIN
|
45 |
|
|
|
46 |
|
|
TEST( "C52103P" , "CHECK THAT IN ARRAY ASSIGNMENTS AND IN SLICE" &
|
47 |
|
|
" ASSIGNMENTS THE LENGTHS MUST MATCH" );
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
-- IN THIS TEST WE CAN'T USE AGGREGATE ASSIGNMENT (EXCEPT WHEN
|
51 |
|
|
-- THE AGGREGATES ARE STRING LITERALS); THEREFORE:
|
52 |
|
|
--
|
53 |
|
|
-- (1) ARRAYS WILL BE INITIALIZED BY INDIVIDUAL ASSIGNMENTS;
|
54 |
|
|
-- (2) CAN'T USE NON-NULL CONSTANT ARRAYS.
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
-- WE ASSUME THAT IN AN ARRAY_TYPE_DEFINITION THE INDEX PORTION
|
58 |
|
|
-- AND THE COMPONENT_TYPE PORTION ARE FUNCTIONALLY ORTHOGONAL
|
59 |
|
|
-- ALSO AT THE IMPLEMENTATION LEVEL, I.E. THAT THE CORRECTNESS
|
60 |
|
|
-- OF THE ACCESSING MECHANISM FOR ARRAYS DOES NOT DEPEND ON
|
61 |
|
|
-- COMPONENT_TYPE. ACCORDINGLY WE ARE TESTING FOR SOME BUT
|
62 |
|
|
-- NOT ALL KINDS OF COMPONENT_TYPE. (COMPONENT_TYPES INCLUDED:
|
63 |
|
|
-- INTEGER , CHARACTER , BOOLEAN .)
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
-- CASES DISTINGUISHED: ( 8 SELECTED CASES ARE IMPLEMENTED)
|
67 |
|
|
--
|
68 |
|
|
-- ( THE SELECTIONS ARE 7 , 8 , 9 ,
|
69 |
|
|
-- AND PRECISELY 5 CASES FROM THE
|
70 |
|
|
-- TWO 5-CASE SERIES 2-3-4-5-6 AND
|
71 |
|
|
-- 10-11-12-13-14)
|
72 |
|
|
--
|
73 |
|
|
-- ( IN THE CURRENT DIVISION, THE 5
|
74 |
|
|
-- FLOATING SELECTIONS ARE 10-3-12-
|
75 |
|
|
-- -5-14 ; THUS THE 8 SELECTIONS ARE
|
76 |
|
|
-- 10-3-12-5-14-7-8-9 (IN THIS ORDER
|
77 |
|
|
-- ).)
|
78 |
|
|
--
|
79 |
|
|
--
|
80 |
|
|
-- ( EACH DIVISION COMPRISES 3 FILES,
|
81 |
|
|
-- COVERING RESPECTIVELY THE FIRST
|
82 |
|
|
-- 3 , NEXT 2 , AND LAST 3 OF THE 8
|
83 |
|
|
-- SELECTIONS FOR THE DIVISION.)
|
84 |
|
|
--
|
85 |
|
|
--
|
86 |
|
|
-- (1) ARRAY OBJECTS DECLARED IN THE SAME DECLARATION.
|
87 |
|
|
-- (TWO-DIMENSIONAL; NON-CONSTRAINABLE TYPEMARK.)
|
88 |
|
|
--
|
89 |
|
|
-- (THIS WILL BE THE ONLY CASE INVOLVING OBJECTS DECLARED
|
90 |
|
|
-- IN THE SAME DECLARATION.)
|
91 |
|
|
--
|
92 |
|
|
--
|
93 |
|
|
-- (2) MULTIDIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS WERE
|
94 |
|
|
-- DEFINED WITHOUT EVER USING THE "BOX" COMPOUND SYMBOL.
|
95 |
|
|
-- (TWO-DIMENSIONAL ARRAYS OF INTEGERS.)
|
96 |
|
|
--
|
97 |
|
|
-- (SLICING IS ILLEGAL; SINCE IN THIS TEST WE ARE NEVER
|
98 |
|
|
-- USING AGGREGATES
|
99 |
|
|
-- (EXCEPT FOR ONE-DIMENSIONAL ARRAYS OF CHARACTERS;
|
100 |
|
|
-- SEE (5) )
|
101 |
|
|
-- AND WE ARE NOT USING CONVERSION-TO-CONSTRAINED-TYPEMARKS
|
102 |
|
|
-- (AS IN T1(ARR) , WHERE ARR IS AN ARRAY
|
103 |
|
|
-- OBJECT AND T1 IS AN ARRAY TYPEMARK SIMILAR
|
104 |
|
|
-- -- AS MORE PRECISELY SPECIFIED IN RM 4.6(B) --
|
105 |
|
|
-- TO THE TYPEMARK OF ARR ),
|
106 |
|
|
-- THE ARRAY ASSIGNMENT CANNOT INVOLVE ANY SLIDING,
|
107 |
|
|
-- AND THE TYPEMARKS ARE ESSENTIALLY THE SAME.)
|
108 |
|
|
--
|
109 |
|
|
--
|
110 |
|
|
-- (3) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
111 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
112 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
113 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
|
114 |
|
|
--
|
115 |
|
|
-- (SINCE WE ARE NOT USING AGGREGATES
|
116 |
|
|
-- AND WE ARE NOT USING CONVERSION-TO-CONSTRAINED-TYPEMARKS,
|
117 |
|
|
-- THE ARRAY ASSIGNMENT CANNOT INVOLVE ANY SLIDING,
|
118 |
|
|
-- AND THE TYPEMARKS ARE ESSENTIALLY THE SAME.)
|
119 |
|
|
--
|
120 |
|
|
--
|
121 |
|
|
-- (4) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
122 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
123 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
124 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
|
125 |
|
|
--
|
126 |
|
|
-- (THE ASSIGNMENT MAY REQUIRE SLIDING.)
|
127 |
|
|
--
|
128 |
|
|
-- (MOST SUBSEQUENT SUBCASES IN THIS TEST (OTHER THAN NULL
|
129 |
|
|
-- ASSIGNMENTS) WILL INVOLVE SLIDING; WE ASSUME THAT
|
130 |
|
|
-- SUBCASES WHICH WORK IN CONJUNCTION WITH SLIDING WORK
|
131 |
|
|
-- ALSO WHEN NO SLIDING IS INVOLVED.)
|
132 |
|
|
--
|
133 |
|
|
--
|
134 |
|
|
-- (5) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
135 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
136 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
|
137 |
|
|
--
|
138 |
|
|
-- (STRING LITERALS ARE THE ONLY AGGREGATES WE ARE USING
|
139 |
|
|
-- IN THIS TEST. TO FORCE SLIDING, THE LOWER LIMIT IMPLIED
|
140 |
|
|
-- BY THE TYPEMARK WILL NOT BE 1 .)
|
141 |
|
|
--
|
142 |
|
|
--
|
143 |
|
|
-- (6) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
144 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
145 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
|
146 |
|
|
--
|
147 |
|
|
--
|
148 |
|
|
-- (7) UNSLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' (BY
|
149 |
|
|
-- THEMSELVES).
|
150 |
|
|
--
|
151 |
|
|
--
|
152 |
|
|
-- (8) SLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' , WITH
|
153 |
|
|
-- STRING LITERALS.
|
154 |
|
|
--
|
155 |
|
|
--
|
156 |
|
|
-- (9) SLICED OBJECTS OF THE PREDEFINED TYPE 'STRING' (BY
|
157 |
|
|
-- THEMSELVES).
|
158 |
|
|
--
|
159 |
|
|
--
|
160 |
|
|
-- (-) CONSTRAINABLE TYPES: ONLY SUBTESTS 2, 3, 4, 5, 6
|
161 |
|
|
-- WILL BE REPLICATED -- AS SUBTESTS 10, 11, 12, 13, 14 .
|
162 |
|
|
--
|
163 |
|
|
--
|
164 |
|
|
-- (10) MULTIDIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS WERE
|
165 |
|
|
-- DEFINED USING THE "BOX" COMPOUND SYMBOL.
|
166 |
|
|
-- (TWO-DIMENSIONAL ARRAYS OF INTEGERS.)
|
167 |
|
|
--
|
168 |
|
|
--
|
169 |
|
|
-- (11) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
170 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
171 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
172 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
|
173 |
|
|
--
|
174 |
|
|
--
|
175 |
|
|
-- (12) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
176 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
177 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
178 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
|
179 |
|
|
--
|
180 |
|
|
--
|
181 |
|
|
-- (13) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
182 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
183 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
|
184 |
|
|
--
|
185 |
|
|
-- (STRING LITERALS ARE THE ONLY AGGREGATES WE ARE USING
|
186 |
|
|
-- IN THIS TEST. TO FORCE SLIDING, THE LOWER LIMIT IMPLIED
|
187 |
|
|
-- BY THE TYPEMARK WILL NOT BE 1 .)
|
188 |
|
|
--
|
189 |
|
|
--
|
190 |
|
|
-- (14) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
191 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
192 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS 'CHARACTER' .
|
193 |
|
|
--
|
194 |
|
|
--
|
195 |
|
|
--
|
196 |
|
|
-- (-) SPECIAL CASES: SUPERLONG ARRAYS.. (TREATED FOR DYNAMIC
|
197 |
|
|
-- ARRAYS ONLY,
|
198 |
|
|
-- DIVISIONS C AND D .)
|
199 |
|
|
--
|
200 |
|
|
--
|
201 |
|
|
-- (-) THE DYNAMIC-ARRAY COUNTERPARTS OF THESE TESTS ARE IN DI-
|
202 |
|
|
-- VISIONS C (FOR NON-NULL ARRAYS) AND D (FOR NULL ARRAYS).
|
203 |
|
|
--
|
204 |
|
|
--
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
-------------------------------------------------------------------
|
208 |
|
|
|
209 |
|
|
-- (10) MULTIDIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS WERE
|
210 |
|
|
-- DEFINED USING THE "BOX" COMPOUND SYMBOL.
|
211 |
|
|
-- (TWO-DIMENSIONAL ARRAYS OF INTEGERS.)
|
212 |
|
|
|
213 |
|
|
DECLARE
|
214 |
|
|
|
215 |
|
|
TYPE TABOX0 IS ARRAY( INTEGER RANGE <> , INTEGER RANGE <>
|
216 |
|
|
) OF INTEGER ;
|
217 |
|
|
|
218 |
|
|
SUBTYPE TABOX01 IS TABOX0( IDENT_INT(1)..IDENT_INT(0) ,
|
219 |
|
|
IDENT_INT(0)..IDENT_INT(7) );
|
220 |
|
|
SUBTYPE TABOX02 IS TABOX0 ;
|
221 |
|
|
|
222 |
|
|
ARRX01 : TABOX01 ;
|
223 |
|
|
ARRX02 : TABOX02( IDENT_INT(7)..IDENT_INT(6) ,
|
224 |
|
|
IDENT_INT(20)..IDENT_INT(27) );
|
225 |
|
|
|
226 |
|
|
BEGIN
|
227 |
|
|
|
228 |
|
|
-- ARRAY ASSIGNMENT:
|
229 |
|
|
|
230 |
|
|
ARRX02 := ARRX01 ;
|
231 |
|
|
|
232 |
|
|
EXCEPTION
|
233 |
|
|
|
234 |
|
|
WHEN OTHERS =>
|
235 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 10" );
|
236 |
|
|
|
237 |
|
|
END ;
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
-------------------------------------------------------------------
|
241 |
|
|
|
242 |
|
|
-- (3) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
243 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
244 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
245 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
|
246 |
|
|
|
247 |
|
|
DECLARE
|
248 |
|
|
|
249 |
|
|
TYPE TA3 IS ARRAY(
|
250 |
|
|
INTEGER RANGE IDENT_INT(100)..IDENT_INT(99)
|
251 |
|
|
) OF INTEGER ;
|
252 |
|
|
|
253 |
|
|
SUBTYPE TA31 IS TA3 ;
|
254 |
|
|
SUBTYPE TA32 IS TA3 ;
|
255 |
|
|
|
256 |
|
|
ARR31 : TA31 ;
|
257 |
|
|
ARR32 : TA32 ;
|
258 |
|
|
|
259 |
|
|
BEGIN
|
260 |
|
|
|
261 |
|
|
-- ARRAY ASSIGNMENT:
|
262 |
|
|
|
263 |
|
|
ARR32 := ARR31 ;
|
264 |
|
|
|
265 |
|
|
EXCEPTION
|
266 |
|
|
|
267 |
|
|
WHEN OTHERS =>
|
268 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 3" );
|
269 |
|
|
|
270 |
|
|
END ;
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
-------------------------------------------------------------------
|
274 |
|
|
|
275 |
|
|
-- (12) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
276 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
277 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
278 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
|
279 |
|
|
|
280 |
|
|
DECLARE
|
281 |
|
|
|
282 |
|
|
TYPE TABOX5 IS ARRAY( INTEGER RANGE <> ) OF BOOLEAN ;
|
283 |
|
|
|
284 |
|
|
SUBTYPE TABOX51 IS TABOX5( IDENT_INT(1)..IDENT_INT(5) );
|
285 |
|
|
|
286 |
|
|
ARRX51 : TABOX51 ;
|
287 |
|
|
ARRX52 : TABOX5( IDENT_INT(5)..IDENT_INT(9) );
|
288 |
|
|
|
289 |
|
|
BEGIN
|
290 |
|
|
|
291 |
|
|
-- INITIALIZATION OF RHS ARRAY:
|
292 |
|
|
|
293 |
|
|
FOR I IN IDENT_INT(1)..IDENT_INT(5) LOOP
|
294 |
|
|
ARRX51( I ) := FALSE ; -- VALUES WILL BE: F T F F T
|
295 |
|
|
END LOOP;
|
296 |
|
|
|
297 |
|
|
ARRX51(2) := TRUE ;
|
298 |
|
|
|
299 |
|
|
ARRX51(5) := TRUE ; -- RHS VALUES ARE: F T F F T
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
-- INITIALIZATION OF LHS ARRAY:
|
303 |
|
|
|
304 |
|
|
FOR I IN IDENT_INT(5)..IDENT_INT(9) LOOP
|
305 |
|
|
ARRX52( I ) := TRUE ; -- VALUES WILL BE: T F T T F
|
306 |
|
|
END LOOP;
|
307 |
|
|
|
308 |
|
|
ARRX52(6) := FALSE ;
|
309 |
|
|
|
310 |
|
|
ARRX52(9) := FALSE ; -- LHS VALUES ARE: T F T T F
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
-- NULL SLICE ASSIGNMENT:
|
314 |
|
|
|
315 |
|
|
ARRX52( IDENT_INT(6)..IDENT_INT(5) ) :=
|
316 |
|
|
ARRX51(
|
317 |
|
|
IDENT_INT(4)..IDENT_INT(3) ) ;
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
-- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
|
321 |
|
|
|
322 |
|
|
IF ARRX52( 5 ) /= TRUE OR
|
323 |
|
|
ARRX52( 6 ) /= FALSE OR
|
324 |
|
|
ARRX52( 7 ) /= TRUE OR
|
325 |
|
|
ARRX52( 8 ) /= TRUE OR
|
326 |
|
|
ARRX52( 9 ) /= FALSE
|
327 |
|
|
THEN
|
328 |
|
|
FAILED( "SLICE ASSIGNMENT NOT CORRECT (VALUES)" );
|
329 |
|
|
END IF;
|
330 |
|
|
|
331 |
|
|
EXCEPTION
|
332 |
|
|
|
333 |
|
|
WHEN OTHERS =>
|
334 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 12" );
|
335 |
|
|
|
336 |
|
|
END ;
|
337 |
|
|
|
338 |
|
|
-------------------------------------------------------------------
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
RESULT ;
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
END C52103P;
|