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/] [c8/] [c83025c.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C83025C.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 A DECLARATION IN A DECLARATIVE REGION OF A GENERIC
27
--     SUBPROGRAM HIDES AN OUTER DECLARATION OF A HOMOGRAPH. ALSO CHECK
28
--     THAT THE OUTER DECLARATION IS DIRECTLY VISIBLE IN BOTH
29
--     DECLARATIVE REGIONS BEFORE THE DECLARATION OF THE INNER HOMOGRAPH
30
--     AND THE OUTER DECLARATION IS VISIBLE BY SELECTION AFTER THE INNER
31
--     HOMOGRAPH DECLARATION, IF THE GENERIC SUBPROGRAM BODY IS COMPILED
32
--     AS A SUBUNIT IN THE SAME COMPILATION.
33
 
34
-- HISTORY:
35
--     BCB 09/01/88  CREATED ORIGINAL TEST.
36
 
37
WITH REPORT; USE REPORT;
38
PRAGMA ELABORATE(REPORT);
39
PACKAGE C83025C_PACK IS
40
     Y : INTEGER := IDENT_INT(5);
41
     Z : INTEGER := Y;
42
 
43
     GENERIC
44
          TYPE T IS PRIVATE;
45
          X : T;
46
     FUNCTION GEN_FUN RETURN T;
47
 
48
     A : INTEGER := IDENT_INT(2);
49
     B : INTEGER := A;
50
 
51
     OBJ : INTEGER := IDENT_INT(3);
52
 
53
     FLO : FLOAT := 5.0;
54
 
55
     TYPE ENUM IS (ONE, TWO, THREE, FOUR);
56
 
57
     EOBJ : ENUM := ONE;
58
 
59
     GENERIC
60
          Y : FLOAT := 2.0;
61
     PROCEDURE INNER (X : IN OUT INTEGER);
62
 
63
     GENERIC
64
          Y : BOOLEAN := TRUE;
65
     PROCEDURE INNER2 (X : IN INTEGER := A;
66
                       A : IN OUT INTEGER);
67
 
68
     GENERIC
69
          Y : ENUM := ONE;
70
     FUNCTION INNER3 (X : INTEGER; Z : ENUM := Y) RETURN INTEGER;
71
 
72
     GENERIC
73
          Y : ENUM;
74
     FUNCTION INNER4 (X : INTEGER; Z : ENUM := Y) RETURN INTEGER;
75
 
76
     GENERIC
77
          Y : CHARACTER := 'A';
78
     PROCEDURE INNER5 (X : IN OUT INTEGER; F : IN FLOAT;
79
                       Z : CHARACTER := Y);
80
END C83025C_PACK;
81
 
82
PACKAGE BODY C83025C_PACK IS
83
     FUNCTION GEN_FUN RETURN T IS
84
     BEGIN
85
          RETURN X;
86
     END GEN_FUN;
87
 
88
     FUNCTION F IS NEW GEN_FUN (INTEGER, OBJ);
89
 
90
     FUNCTION F IS NEW GEN_FUN (FLOAT, FLO);
91
 
92
     PROCEDURE INNER (X : IN OUT INTEGER) IS SEPARATE;
93
 
94
     PROCEDURE INNER2 (X : IN INTEGER := C83025C_PACK.A;
95
                       A : IN OUT INTEGER) IS SEPARATE;
96
 
97
     FUNCTION INNER3 (X : INTEGER;
98
                      Z : ENUM := Y) RETURN INTEGER IS SEPARATE;
99
 
100
     FUNCTION INNER4 (X : INTEGER;
101
                      Z : ENUM := Y) RETURN INTEGER IS SEPARATE;
102
 
103
     PROCEDURE INNER5 (X : IN OUT INTEGER; F : IN FLOAT;
104
                       Z : CHARACTER := Y) IS SEPARATE;
105
END C83025C_PACK;
106
 
107
SEPARATE (C83025C_PACK)
108
PROCEDURE INNER (X : IN OUT INTEGER) IS
109
     C : INTEGER := A;
110
     A : INTEGER := IDENT_INT(3);
111
BEGIN
112
     IF A /= IDENT_INT(3) THEN
113
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 1");
114
     END IF;
115
 
116
     IF C83025C_PACK.A /= IDENT_INT(2) THEN
117
          FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 2");
118
     END IF;
119
 
120
     IF C83025C_PACK.B /= IDENT_INT(2) THEN
121
          FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 3");
122
     END IF;
123
 
124
     IF C /= IDENT_INT(2) THEN
125
          FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 4");
126
     END IF;
127
 
128
     IF X /= IDENT_INT(2) THEN
129
          FAILED ("INCORRECT VALUE PASSED IN - 5");
130
     END IF;
131
 
132
     IF Y /= 2.0 THEN
133
          FAILED ("INCORRECT VALUE INNER HOMOGRAPH - 6");
134
     END IF;
135
 
136
     IF EQUAL(1,1) THEN
137
          X := A;
138
     ELSE
139
          X := C83025C_PACK.A;
140
     END IF;
141
END INNER;
142
 
143
SEPARATE (C83025C_PACK)
144
PROCEDURE INNER2 (X : IN INTEGER := C83025C_PACK.A;
145
                 A : IN OUT INTEGER) IS
146
     C : INTEGER := A;
147
BEGIN
148
     IF A /= IDENT_INT(3) THEN
149
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 10");
150
     END IF;
151
 
152
     IF C83025C_PACK.A /= IDENT_INT(2) THEN
153
          FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 11");
154
     END IF;
155
 
156
     IF C83025C_PACK.B /= IDENT_INT(2) THEN
157
          FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 12");
158
     END IF;
159
 
160
     IF C /= IDENT_INT(3) THEN
161
          FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 13");
162
     END IF;
163
 
164
     IF X /= IDENT_INT(2) THEN
165
          FAILED ("INCORRECT VALUE PASSED IN - 14");
166
     END IF;
167
 
168
     IF Y /= TRUE THEN
169
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 15");
170
     END IF;
171
 
172
     IF EQUAL(1,1) THEN
173
          A := IDENT_INT(4);
174
     ELSE
175
          A := 1;
176
     END IF;
177
END INNER2;
178
 
179
SEPARATE (C83025C_PACK)
180
FUNCTION INNER3 (X : INTEGER; Z : ENUM := Y) RETURN INTEGER IS
181
     C : INTEGER := A;
182
     A : INTEGER := IDENT_INT(3);
183
BEGIN
184
     IF A /= IDENT_INT(3) THEN
185
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 20");
186
     END IF;
187
 
188
     IF C83025C_PACK.A /= IDENT_INT(2) THEN
189
          FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 21");
190
     END IF;
191
 
192
     IF C83025C_PACK.B /= IDENT_INT(2) THEN
193
          FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 22");
194
     END IF;
195
 
196
     IF C /= IDENT_INT(2) THEN
197
          FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 23");
198
     END IF;
199
 
200
     IF X /= IDENT_INT(2) THEN
201
          FAILED ("INCORRECT VALUE PASSED IN - 24");
202
     END IF;
203
 
204
     IF Y /= ONE THEN
205
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 25");
206
     END IF;
207
 
208
     IF Z /= ONE THEN
209
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 26");
210
     END IF;
211
 
212
     IF EQUAL(1,1) THEN
213
          RETURN A;
214
     ELSE
215
          RETURN X;
216
     END IF;
217
END INNER3;
218
 
219
SEPARATE (C83025C_PACK)
220
FUNCTION INNER4 (X : INTEGER; Z : ENUM := Y) RETURN INTEGER IS
221
     C : INTEGER := A;
222
     A : INTEGER := IDENT_INT(3);
223
BEGIN
224
     IF A /= IDENT_INT(3) THEN
225
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 30");
226
     END IF;
227
 
228
     IF C83025C_PACK.A /= IDENT_INT(2) THEN
229
          FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 31");
230
     END IF;
231
 
232
     IF C83025C_PACK.B /= IDENT_INT(2) THEN
233
          FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 32");
234
     END IF;
235
 
236
     IF C /= IDENT_INT(2) THEN
237
          FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 33");
238
     END IF;
239
 
240
     IF X /= IDENT_INT(2) THEN
241
          FAILED ("INCORRECT VALUE PASSED IN - 34");
242
     END IF;
243
 
244
     IF Y /= ONE THEN
245
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 35");
246
     END IF;
247
 
248
     IF Z /= ONE THEN
249
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 36");
250
     END IF;
251
 
252
     IF EQUAL(1,1) THEN
253
          RETURN A;
254
     ELSE
255
          RETURN X;
256
     END IF;
257
END INNER4;
258
 
259
SEPARATE (C83025C_PACK)
260
PROCEDURE INNER5 (X : IN OUT INTEGER; F : IN FLOAT;
261
                  Z : CHARACTER := Y) IS
262
BEGIN
263
     X := INTEGER(F);
264
 
265
     IF Y /= 'A' THEN
266
          FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 40");
267
     END IF;
268
 
269
     IF Z /= 'A' THEN
270
          FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 41");
271
     END IF;
272
END INNER5;
273
 
274
WITH REPORT; USE REPORT;
275
WITH C83025C_PACK; USE C83025C_PACK;
276
PROCEDURE C83025C IS
277
 
278
     PROCEDURE NEW_INNER IS NEW INNER;
279
 
280
     PROCEDURE NEW_INNER2 IS NEW INNER2;
281
 
282
     FUNCTION NEW_INNER3 IS NEW INNER3;
283
 
284
     FUNCTION NEW_INNER4 IS NEW INNER4 (Y => EOBJ);
285
 
286
     PROCEDURE NEW_INNER5 IS NEW INNER5;
287
 
288
BEGIN
289
     TEST ("C83025C", "CHECK THAT A DECLARATION IN A DECLARATIVE " &
290
                      "REGION OF A GENERIC SUBPROGRAM HIDES AN OUTER " &
291
                      "DECLARATION OF A HOMOGRAPH");
292
 
293
     A := IDENT_INT(2);
294
     B := A;
295
 
296
     NEW_INNER (A);
297
 
298
     IF A /= IDENT_INT(3) THEN
299
          FAILED ("INCORRECT VALUE PASSED OUT - 7");
300
     END IF;
301
 
302
     A := IDENT_INT(2);
303
 
304
     NEW_INNER2 (A => OBJ);
305
 
306
     IF OBJ /= IDENT_INT(4) THEN
307
          FAILED ("INCORRECT VALUE PASSED OUT - 16");
308
     END IF;
309
 
310
     A := IDENT_INT(2);
311
 
312
     B := A;
313
 
314
     IF NEW_INNER3(A) /= IDENT_INT(3) THEN
315
          FAILED ("INCORRECT VALUE PASSED OUT - 27");
316
     END IF;
317
 
318
     A := IDENT_INT(2);
319
 
320
     B := A;
321
 
322
     IF NEW_INNER4(A) /= IDENT_INT(3) THEN
323
          FAILED ("INCORRECT VALUE PASSED OUT - 37");
324
     END IF;
325
 
326
     OBJ := 1;
327
 
328
     FLO := 6.25;
329
 
330
     NEW_INNER5 (OBJ, FLO);
331
 
332
     IF OBJ /= IDENT_INT(6) THEN
333
          FAILED ("INCORRECT VALUE RETURNED FROM FUNCTION - 42");
334
     END IF;
335
 
336
     IF Y /= 5 THEN
337
          FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 50");
338
     END IF;
339
 
340
     IF Z /= 5 THEN
341
          FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 51");
342
     END IF;
343
 
344
     RESULT;
345
END C83025C;

powered by: WebSVN 2.1.0

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