1 |
12 |
jlechner |
-- C52103F.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 B : STATICALLY-DETERMINABLE NULL LENGTHS.
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
-- RM 07/20/81
|
36 |
|
|
-- SPS 3/22/83
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
WITH REPORT;
|
40 |
|
|
PROCEDURE C52103F IS
|
41 |
|
|
|
42 |
|
|
USE REPORT ;
|
43 |
|
|
|
44 |
|
|
BEGIN
|
45 |
|
|
|
46 |
|
|
TEST( "C52103F" , "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( 1..0 , 0..7 );
|
219 |
|
|
SUBTYPE TABOX02 IS TABOX0 ;
|
220 |
|
|
|
221 |
|
|
ARRX01 : TABOX01 ;
|
222 |
|
|
ARRX02 : TABOX02( 7..6 , 20..27 );
|
223 |
|
|
|
224 |
|
|
BEGIN
|
225 |
|
|
|
226 |
|
|
-- ARRAY ASSIGNMENT:
|
227 |
|
|
|
228 |
|
|
ARRX02 := ARRX01 ;
|
229 |
|
|
|
230 |
|
|
EXCEPTION
|
231 |
|
|
|
232 |
|
|
WHEN OTHERS =>
|
233 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 10" );
|
234 |
|
|
|
235 |
|
|
END ;
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
-------------------------------------------------------------------
|
239 |
|
|
|
240 |
|
|
-- (3) UNSLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
241 |
|
|
-- WERE DEFINED WITHOUT EVER USING THE "BOX" SYMBOL
|
242 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
243 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF INTEGERS.)
|
244 |
|
|
|
245 |
|
|
DECLARE
|
246 |
|
|
|
247 |
|
|
TYPE TA3 IS ARRAY( INTEGER RANGE 100..99 ) OF INTEGER ;
|
248 |
|
|
|
249 |
|
|
SUBTYPE TA31 IS TA3 ;
|
250 |
|
|
SUBTYPE TA32 IS TA3 ;
|
251 |
|
|
|
252 |
|
|
ARR31 : TA31 ;
|
253 |
|
|
ARR32 : TA32 ;
|
254 |
|
|
|
255 |
|
|
BEGIN
|
256 |
|
|
|
257 |
|
|
-- ARRAY ASSIGNMENT:
|
258 |
|
|
|
259 |
|
|
ARR32 := ARR31 ;
|
260 |
|
|
|
261 |
|
|
EXCEPTION
|
262 |
|
|
|
263 |
|
|
WHEN OTHERS =>
|
264 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 3" );
|
265 |
|
|
|
266 |
|
|
END ;
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
-------------------------------------------------------------------
|
270 |
|
|
|
271 |
|
|
-- (12) SLICED ONE-DIMENSIONAL ARRAY OBJECTS WHOSE TYPEMARKS
|
272 |
|
|
-- WERE DEFINED USING THE "BOX" SYMBOL
|
273 |
|
|
-- AND FOR WHICH THE COMPONENT TYPE IS NOT 'CHARACTER' .
|
274 |
|
|
-- ((ONE-DIMENSIONAL) ARRAYS OF BOOLEANS.)
|
275 |
|
|
|
276 |
|
|
DECLARE
|
277 |
|
|
|
278 |
|
|
TYPE TABOX5 IS ARRAY( INTEGER RANGE <> ) OF BOOLEAN ;
|
279 |
|
|
|
280 |
|
|
SUBTYPE TABOX51 IS TABOX5( 1..5 );
|
281 |
|
|
|
282 |
|
|
ARRX51 : TABOX51 ;
|
283 |
|
|
ARRX52 : TABOX5( 5..9 );
|
284 |
|
|
|
285 |
|
|
BEGIN
|
286 |
|
|
|
287 |
|
|
-- INITIALIZATION OF RHS ARRAY:
|
288 |
|
|
|
289 |
|
|
FOR I IN 1..5 LOOP
|
290 |
|
|
ARRX51( I ) := FALSE ; -- VALUES WILL BE: F T F F T
|
291 |
|
|
END LOOP;
|
292 |
|
|
|
293 |
|
|
ARRX51(2) := TRUE ;
|
294 |
|
|
|
295 |
|
|
ARRX51(5) := TRUE ; -- RHS VALUES ARE: F T F F T
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
-- INITIALIZATION OF LHS ARRAY:
|
299 |
|
|
|
300 |
|
|
FOR I IN 5..9 LOOP
|
301 |
|
|
ARRX52( I ) := TRUE ; -- VALUES WILL BE: T F T T F
|
302 |
|
|
END LOOP;
|
303 |
|
|
|
304 |
|
|
ARRX52(6) := FALSE ;
|
305 |
|
|
|
306 |
|
|
ARRX52(9) := FALSE ; -- LHS VALUES ARE: T F T T F
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
-- NULL SLICE ASSIGNMENT:
|
310 |
|
|
|
311 |
|
|
ARRX52(6..5) := ARRX51(4..3) ;
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
-- CHECKING THE VALUES AFTER THE SLICE ASSIGNMENT:
|
315 |
|
|
|
316 |
|
|
IF ARRX52( 5 ) /= TRUE OR
|
317 |
|
|
ARRX52( 6 ) /= FALSE OR
|
318 |
|
|
ARRX52( 7 ) /= TRUE OR
|
319 |
|
|
ARRX52( 8 ) /= TRUE OR
|
320 |
|
|
ARRX52( 9 ) /= FALSE
|
321 |
|
|
THEN
|
322 |
|
|
FAILED( "SLICE ASSIGNMENT NOT CORRECT (VALUES)" );
|
323 |
|
|
END IF;
|
324 |
|
|
|
325 |
|
|
EXCEPTION
|
326 |
|
|
|
327 |
|
|
WHEN OTHERS =>
|
328 |
|
|
FAILED( "EXCEPTION RAISED - SUBTEST 12" );
|
329 |
|
|
|
330 |
|
|
END ;
|
331 |
|
|
|
332 |
|
|
-------------------------------------------------------------------
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
RESULT ;
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
END C52103F;
|