OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c5/] [c52103k.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.