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/] [c52103a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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