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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c41103b.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C41103B.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
-- OBJECTIVE:
26
--     CHECK THAT THE NAME IN AN INDEXED_COMPONENT MAY BE:
27
--        AN IDENTIFIER DENOTING AN ARRAY OBJECT - N1;
28
--        AN IDENTIFIER DENOTING AN ACCESS OBJECT WHOSE VALUE
29
--           DESIGNATES AN ARRAY OBJECT - N2;
30
--        A FUNCTION CALL DELIVERING AN ARRAY OBJECT USING
31
--           PREDEFINED FUNCTIONS - &, AND THE LOGICAL OPERATORS
32
--        A USER-DEFINED FUNCTION - F1;
33
--        A FUNCTION CALL DELIVERING AN ACCESS VALUE THAT
34
--           DESIGNATES AN ARRAY - F2;
35
--        A SLICE (CHECKING UPPER AND LOWER BOUND COMPONENTS) - N3;
36
--        AN INDEXED COMPONENT DENOTING AN ARRAY OBJECT
37
--           (ARRAY OF ARRAYS) - N4;
38
--        AN IDENTIFIER PREFIXED BY THE NAME OF THE INNERMOST UNIT
39
--           ENCLOSING ITS DECLARATION - C41103B.N1;
40
--        A RECORD COMPONENT (OF A RECORD CONTAINING ONE OR MORE
41
--           ARRAYS WHOSE BOUNDS DEPEND ON A DISCRIMINANT) - N5.
42
--     CHECK THAT THE APPROPRIATE COMPONENT IS ACCESSED (FOR
43
--     DYNAMIC INDICES).
44
 
45
-- HISTORY:
46
--     WKB 08/05/81  CREATED ORIGINAL TEST.
47
--     SPS 10/26/82
48
--     BCB 08/02/88  MODIFIED HEADER FORMAT AND ADDED CALLS TO THE
49
--                   LOGICAL OPERATORS.
50
--     BCB 04/16/90  MODIFIED SLICE TEST TO INCLUDE A READING OF THE
51
--                   COMPONENT DESIGNATED BY THE LOWER BOUND OF THE
52
--                   SLICE.  ADDED TEST FOR PREFIX OF INDEXED COMPONENT
53
--                   HAVING A LIMITED TYPE.
54
--     PWN 11/30/94  SUBTYPE QUALIFIED LITERALS FOR ADA 9X.
55
 
56
WITH REPORT;
57
USE REPORT;
58
PROCEDURE C41103B IS
59
 
60
     TYPE A1 IS ARRAY (INTEGER RANGE 1..4) OF INTEGER;
61
     N1 : A1 := (1,2,3,4);
62
 
63
BEGIN
64
     TEST ("C41103B", "CHECK THAT AN INDEXED_COMPONENT MAY BE OF " &
65
                      "CERTAIN FORMS AND THAT THE APPROPRIATE " &
66
                      "COMPONENT IS ACCESSED (FOR DYNAMIC INDICES)");
67
 
68
     DECLARE
69
 
70
          TYPE A2 IS ARRAY (INTEGER RANGE 1..4) OF BOOLEAN;
71
          TYPE A3 IS ACCESS A1;
72
          TYPE A4 IS ARRAY (INTEGER RANGE 1..4) OF A1;
73
          TYPE R (LENGTH : INTEGER) IS
74
               RECORD
75
                    S : STRING (1..LENGTH);
76
               END RECORD;
77
 
78
          N2 : A3 := NEW A1' (1,2,3,4);
79
          N3 : ARRAY (1..7) OF INTEGER := (1,2,3,4,5,6,7);
80
          N4 : A4 := (1 => (1,2,3,4), 2 => (5,6,7,8),
81
                      3 => (9,10,11,12), 4 => (13,14,15,16));
82
          N5 : R(4) := (LENGTH => 4, S => "ABCD");
83
 
84
          M2A : A2 := (TRUE,FALSE,TRUE,FALSE);
85
          M2B : A2 := (TRUE,TRUE,FALSE,FALSE);
86
 
87
          FUNCTION F1 RETURN A2 IS
88
          BEGIN
89
               RETURN (FALSE,FALSE,TRUE,FALSE);
90
          END F1;
91
 
92
          FUNCTION F2 RETURN A3 IS
93
          BEGIN
94
               RETURN N2;
95
          END F2;
96
 
97
          PROCEDURE P1 (X : IN INTEGER; Y : IN OUT INTEGER;
98
                        Z : OUT INTEGER; W : IN STRING) IS
99
          BEGIN
100
               IF X /= 2 THEN
101
                    FAILED ("WRONG VALUE FOR IN PARAMETER - " & W);
102
               END IF;
103
               IF Y /= 3 THEN
104
                    FAILED ("WRONG VALUE FOR IN OUT PARAMETER - " & W);
105
               END IF;
106
               Y := 8;
107
               Z := 9;
108
          END P1;
109
 
110
          PROCEDURE P2 (X : CHARACTER) IS
111
          BEGIN
112
               IF X /= 'C' THEN
113
                    FAILED ("WRONG VALUE FOR IN PARAMETER - '&'");
114
               END IF;
115
          END P2;
116
 
117
          PROCEDURE P3 (X : BOOLEAN) IS
118
          BEGIN
119
               IF X /= TRUE THEN
120
                    FAILED ("WRONG VALUE FOR IN PARAMETER - F1");
121
               END IF;
122
          END P3;
123
 
124
          PROCEDURE P5 (X : IN CHARACTER; Y : IN OUT CHARACTER;
125
                        Z : OUT CHARACTER) IS
126
          BEGIN
127
               IF X /= 'A' THEN
128
                    FAILED ("WRONG VALUE FOR IN PARAMETER - N5");
129
               END IF;
130
               IF Y /= 'D' THEN
131
                    FAILED ("WRONG VALUE FOR IN OUT PARAMETER - N5");
132
               END IF;
133
               Y := 'Y';
134
               Z := 'Z';
135
          END P5;
136
 
137
          PROCEDURE P6 (X : BOOLEAN) IS
138
          BEGIN
139
               IF X /= TRUE THEN
140
                    FAILED ("WRONG VALUE FOR IN PARAMETER - NOT");
141
               END IF;
142
          END P6;
143
 
144
          PROCEDURE P7 (X : BOOLEAN) IS
145
          BEGIN
146
               IF X /= TRUE THEN
147
                    FAILED ("WRONG VALUE FOR IN PARAMETER - AND");
148
               END IF;
149
          END P7;
150
 
151
          PROCEDURE P8 (X : BOOLEAN) IS
152
          BEGIN
153
               IF X /= TRUE THEN
154
                    FAILED ("WRONG VALUE FOR IN PARAMETER - OR");
155
               END IF;
156
          END P8;
157
 
158
          PROCEDURE P9 (X : BOOLEAN) IS
159
          BEGIN
160
               IF X /= TRUE THEN
161
                    FAILED ("WRONG VALUE FOR IN PARAMETER - XOR");
162
               END IF;
163
          END P9;
164
 
165
     BEGIN
166
 
167
          IF N1(IDENT_INT(2)) /= 2 THEN
168
               FAILED ("WRONG VALUE FOR EXPRESSION - N1");
169
          END IF;
170
          N1(IDENT_INT(2)) := 7;
171
          IF N1 /= (1,7,3,4) THEN
172
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N1");
173
          END IF;
174
          N1 := (1,2,3,4);
175
          P1 (N1(IDENT_INT(2)), N1(IDENT_INT(3)),
176
              N1(IDENT_INT(1)), "N1");
177
          IF N1 /= (9,2,8,4) THEN
178
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N1");
179
          END IF;
180
 
181
          IF N2(IDENT_INT(3)) /= 3 THEN
182
               FAILED ("WRONG VALUE FOR EXPRESSION - N2");
183
          END IF;
184
          N2(IDENT_INT(3)) := 7;
185
          IF N2.ALL /= (1,2,7,4) THEN
186
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N2");
187
          END IF;
188
          N2.ALL := (2,1,4,3);
189
          P1 (N2(IDENT_INT(1)), N2(IDENT_INT(4)),
190
              N2(IDENT_INT(2)), "N2");
191
          IF N2.ALL /= (2,9,4,8) THEN
192
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N2");
193
          END IF;
194
 
195
          IF "&" (STRING'("AB"), STRING'("CDEF"))(IDENT_INT(5))
196
             /= CHARACTER'('E') THEN
197
               FAILED ("WRONG VALUE FOR EXPRESSION - '&'");
198
          END IF;
199
          P2 ("&" ("AB", "CD")(IDENT_INT(3)));
200
 
201
          IF "NOT" (M2A)(IDENT_INT(4)) /= TRUE THEN
202
               FAILED ("WRONG VALUE FOR EXPRESSION - 'NOT'");
203
          END IF;
204
          P6 ("NOT" (M2A)(IDENT_INT(4)));
205
 
206
          IF "AND" (M2A,M2B)(IDENT_INT(3)) /= FALSE THEN
207
               FAILED ("WRONG VALUE FOR EXPRESSION - 'AND'");
208
          END IF;
209
          P7 ("AND" (M2A,M2B)(IDENT_INT(1)));
210
 
211
          IF "OR" (M2A,M2B)(IDENT_INT(3)) /= TRUE THEN
212
               FAILED ("WRONG VALUE FOR EXPRESSION - 'OR'");
213
          END IF;
214
          P8 ("OR" (M2A,M2B)(IDENT_INT(3)));
215
 
216
          IF "XOR" (M2A,M2B)(IDENT_INT(1)) /= FALSE THEN
217
               FAILED ("WRONG VALUE FOR EXPRESSION - 'XOR'");
218
          END IF;
219
          P9 ("XOR" (M2A,M2B)(IDENT_INT(3)));
220
 
221
          IF F1(IDENT_INT(3)) /= TRUE THEN
222
               FAILED ("WRONG VALUE FOR EXPRESSION - F1");
223
          END IF;
224
          P3 (F1(IDENT_INT(3)));
225
 
226
          N2 := NEW A1'(1,2,3,4);
227
          IF F2(IDENT_INT(2)) /= 2 THEN
228
               FAILED ("WRONG VALUE FOR EXPRESSION - F2");
229
          END IF;
230
          F2(IDENT_INT(3)) := 7;
231
          IF N2.ALL /= (1,2,7,4) THEN
232
               FAILED ("WRONG TARGET FOR ASSIGNMENT - F2");
233
          END IF;
234
          N2.ALL := (1,2,3,4);
235
          P1 (F2(IDENT_INT(2)), F2(IDENT_INT(3)),
236
              F2(IDENT_INT(1)), "F2");
237
          IF N2.ALL /= (9,2,8,4) THEN
238
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - F2");
239
          END IF;
240
 
241
          IF N3(2..5)(IDENT_INT(2)) /= 2 THEN
242
               FAILED ("WRONG VALUE FOR EXPRESSION (LOWER BOUND) - N3");
243
          END IF;
244
          IF N3(2..5)(IDENT_INT(5)) /= 5 THEN
245
               FAILED ("WRONG VALUE FOR EXPRESSION (UPPER BOUND) - N3");
246
          END IF;
247
          N3(2..5)(IDENT_INT(2)) := 8;
248
          IF N3 /= (1,8,3,4,5,6,7) THEN
249
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N3");
250
          END IF;
251
          N3 := (5,3,4,2,1,6,7);
252
          P1 (N3(2..5)(IDENT_INT(4)), N3(2..5)(IDENT_INT(2)),
253
              N3(2..5)(IDENT_INT(5)), "N3");
254
          IF N3 /= (5,8,4,2,9,6,7) THEN
255
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N3");
256
          END IF;
257
 
258
          IF N4(1)(IDENT_INT(2)) /= 2 THEN
259
               FAILED ("WRONG VALUE FOR EXPRESSION - N4");
260
          END IF;
261
          N4(3)(IDENT_INT(1)) := 20;
262
          IF N4 /= ((1,2,3,4),(5,6,7,8),(20,10,11,12),
263
                    (13,14,15,16)) THEN
264
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N4");
265
          END IF;
266
          N4 := (1 => (0,6,4,2), 2 => (10,11,12,13),
267
                 3 => (14,15,16,17), 4 => (7,5,3,1));
268
          P1 (N4(1)(IDENT_INT(4)), N4(4)(IDENT_INT(3)),
269
              N4(2)(IDENT_INT(1)), "N4");
270
          IF N4 /= ((0,6,4,2),(9,11,12,13),(14,15,16,17),
271
                    (7,5,8,1)) THEN
272
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N4");
273
          END IF;
274
 
275
          N1 := (1,2,3,4);
276
          IF C41103B.N1(IDENT_INT(2)) /= 2 THEN
277
               FAILED ("WRONG VALUE FOR EXPRESSION - C41103B.N1");
278
          END IF;
279
          C41103B.N1(IDENT_INT(2)) := 7;
280
          IF N1 /= (1,7,3,4) THEN
281
               FAILED ("WRONG TARGET FOR ASSIGNMENT - C41103B.N1");
282
          END IF;
283
          N1 := (1,2,3,4);
284
          P1 (C41103B.N1(IDENT_INT(2)), C41103B.N1(IDENT_INT(3)),
285
              C41103B.N1(IDENT_INT(1)), "C41103B.N1");
286
          IF N1 /= (9,2,8,4) THEN
287
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER " &
288
                       "- C41103B.N1");
289
          END IF;
290
 
291
          IF N5.S(IDENT_INT(3)) /= 'C' THEN
292
               FAILED ("WRONG VALUE FOR EXPRESSION - N5");
293
          END IF;
294
          N5.S(IDENT_INT(4)) := 'X';
295
          IF N5.S /= "ABCX" THEN
296
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N5");
297
          END IF;
298
          N5.S := "ABCD";
299
          P5 (N5.S(IDENT_INT(1)), N5.S(IDENT_INT(4)),
300
              N5.S(IDENT_INT(2)));
301
          IF N5.S /= "AZCY" THEN
302
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N5");
303
          END IF;
304
 
305
          DECLARE
306
               PACKAGE P IS
307
                    TYPE LIM IS LIMITED PRIVATE;
308
                    PROCEDURE INIT (V : OUT LIM; X,Y,Z : INTEGER);
309
                    PROCEDURE ASSIGN (ONE : OUT LIM; TWO : LIM);
310
                    FUNCTION "=" (ONE,TWO : LIM) RETURN BOOLEAN;
311
               PRIVATE
312
                    TYPE LIM IS ARRAY(1..3) OF INTEGER;
313
               END P;
314
 
315
               USE P;
316
 
317
               TYPE A IS ARRAY(1..3) OF LIM;
318
 
319
               H : A;
320
 
321
               N6 : LIM;
322
 
323
               PACKAGE BODY P IS
324
                    PROCEDURE INIT (V : OUT LIM; X,Y,Z : INTEGER) IS
325
                    BEGIN
326
                         V := (X,Y,Z);
327
                    END INIT;
328
 
329
                    PROCEDURE ASSIGN (ONE : OUT LIM; TWO : LIM) IS
330
                    BEGIN
331
                         ONE := TWO;
332
                    END ASSIGN;
333
 
334
                    FUNCTION "=" (ONE,TWO : LIM) RETURN BOOLEAN IS
335
                    BEGIN
336
                         IF ONE(1) = TWO(1) AND ONE(2) = TWO(2) AND
337
                           ONE(3) = TWO(3) THEN
338
                              RETURN TRUE;
339
                         ELSE
340
                              RETURN FALSE;
341
                         END IF;
342
                    END "=";
343
               END P;
344
 
345
               FUNCTION FR RETURN A IS
346
               BEGIN
347
                    RETURN H;
348
               END FR;
349
 
350
          BEGIN
351
               INIT (H(1),1,2,3);
352
               INIT (H(2),4,5,6);
353
               INIT (H(3),7,8,9);
354
               INIT (N6,0,0,0);
355
 
356
               ASSIGN (N6,FR(2));
357
 
358
               IF N6 /= FR(2) THEN
359
                    FAILED ("WRONG VALUE FROM LIMITED COMPONENT TYPE");
360
               END IF;
361
 
362
          END;
363
     END;
364
 
365
     RESULT;
366
END C41103B;

powered by: WebSVN 2.1.0

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