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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C84002A.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:
26
 
27
--   A) IF A USE CLAUSE NAMES AN ENCLOSING PACKAGE, THE USE CLAUSE
28
--      HAS NO EFFECT.
29
 
30
--   B) IF A DECLARATION IS DIRECTLY VISIBLE PRIOR TO THE OCCURRENCE
31
--      OF A USE CLAUSE, AND IS NOT IN THE SET OF POTENTIALLY
32
--      VISIBLE DECLARATIONS, IT REMAINS DIRECTLY VISIBLE AFTER THE
33
--      USE CLAUSE.
34
 
35
--   C) IF A HOMOGRAPH FOR A POTENTIALLY VISIBLE SUBPROGRAM OR
36
--      OBJECT IS DECLARED AFTER A USE CLAUSE, THE POTENTIALLY
37
--      VISIBLE ENTITY IS NO LONGER VISIBLE.
38
 
39
-- EG  02/16/84
40
 
41
WITH REPORT;
42
 
43
PROCEDURE C84002A IS
44
 
45
     USE REPORT;
46
 
47
BEGIN
48
 
49
     TEST("C84002A","CHECK THAT DECLARATIONS DIRECTLY VISIBLE PRIOR " &
50
                    "TO THE USE CLAUSE REMAIN VISIBLE AFTERWARDS");
51
 
52
     BEGIN
53
 
54
          COMMENT ("CASE A : CHECK THAT IF A USE CLAUSE NAMES AN " &
55
                   "ENCLOSING PACKAGE, THE USE CLAUSE HAS NO EFFECT");
56
 
57
CASE_A :  DECLARE
58
 
59
               PACKAGE P1 IS
60
                    X : FLOAT := 1.5;
61
               END P1;
62
               PACKAGE P2 IS
63
                    X : INTEGER := 15;
64
 
65
                    USE P1;
66
                    USE P2;
67
 
68
                    A : INTEGER := X;
69
               END P2;
70
               PACKAGE BODY P1 IS
71
               BEGIN
72
                    NULL;
73
               END P1;
74
               PACKAGE BODY P2 IS
75
               BEGIN
76
                    IF X /= IDENT_INT(15) OR X /= P2.X OR
77
                       A /= P2.X THEN
78
                         FAILED ("CASE A : USE CLAUSE HAS AN EFFECT");
79
                    END IF;
80
               END P2;
81
 
82
          BEGIN
83
 
84
               NULL;
85
 
86
          END CASE_A;
87
 
88
          COMMENT ("CASE B : CHECK THAT IF A DECLARATION IS DIRECTLY " &
89
                   "VISIBLE PRIOR TO THE OCCURRENCE OF A USE CLAUSE, " &
90
                   "AND IS NOT IN THE SET OF POTENTIALLY VISIBLE "     &
91
                   "DECLARATIONS, IT REMAINS DIRECTLY VISIBLE");
92
 
93
CASE_B :  BEGIN
94
 
95
     CASE_B1 : DECLARE
96
 
97
                    PACKAGE P1 IS
98
                         Y : FLOAT := 1.5;
99
                    END P1;
100
                    PACKAGE P2 IS
101
                         X : INTEGER := 15;
102
 
103
                         USE P1;
104
 
105
                         A : INTEGER := X;
106
                    END P2;
107
 
108
                    PACKAGE BODY P1 IS
109
                    BEGIN
110
                         NULL;
111
                    END P1;
112
                    PACKAGE BODY P2 IS
113
                    BEGIN
114
                         IF X /= IDENT_INT(15) OR X /= P2.X OR
115
                            A /= P2.X THEN
116
                              FAILED ("CASE B1 : DECLARATION NO " &
117
                                      "LONGER DIRECTLY VISIBLE");
118
                         END IF;
119
                    END P2;
120
 
121
               BEGIN
122
 
123
                    NULL;
124
 
125
               END CASE_B1;
126
 
127
     CASE_B2 : DECLARE
128
 
129
                    PROCEDURE PROC1 (X : STRING) IS
130
                    BEGIN
131
                         NULL;
132
                    END PROC1;
133
 
134
                    PACKAGE P1 IS
135
                         PROCEDURE PROC1 (X : STRING);
136
                    END P1;
137
                    PACKAGE BODY P1 IS
138
                         PROCEDURE PROC1 (X : STRING) IS
139
                         BEGIN
140
                              FAILED ("CASE B2 : WRONG PROCEDURE " &
141
                                      "DIRECTLY VISIBLE");
142
                         END PROC1;
143
                    END P1;
144
 
145
                    USE P1;
146
 
147
               BEGIN
148
 
149
                    PROC1 ("ABC");
150
 
151
               END CASE_B2;
152
 
153
     CASE_B3 : DECLARE
154
 
155
                    PROCEDURE PROC1 (X : STRING) IS
156
                    BEGIN
157
                         NULL;
158
                    END PROC1;
159
 
160
                    PACKAGE P1 IS
161
                         PROCEDURE PROC1 (Y : STRING);
162
                    END P1;
163
                    PACKAGE BODY P1 IS
164
                         PROCEDURE PROC1 (Y : STRING) IS
165
                         BEGIN
166
                              FAILED ("CASE B3 : WRONG PROCEDURE " &
167
                                      "DIRECTLY VISIBLE");
168
                         END PROC1;
169
                    END P1;
170
 
171
                    USE P1;
172
 
173
               BEGIN
174
 
175
                    PROC1 ("ABC");
176
 
177
               END CASE_B3;
178
 
179
          END CASE_B;
180
 
181
          COMMENT ("CASE C : IF A HOMOGRAPH FOR A POTENTIALLY "      &
182
                   "VISIBLE SUBPROGRAM OR OBJECT IS DECLARED AFTER " &
183
                   "A USE CLAUSE, THE POTENTIALLY VISIBLE ENTITY "   &
184
                   "IS NO LONGER VISIBLE");
185
 
186
CASE_C :  BEGIN
187
 
188
     CASE_C1 : DECLARE
189
 
190
                    PACKAGE P1 IS
191
                         PROCEDURE PROC1 (X : FLOAT);
192
                    END P1;
193
 
194
                    USE P1;
195
 
196
                    PACKAGE BODY P1 IS
197
                         PROCEDURE PROC1 (X : FLOAT) IS
198
                         BEGIN
199
                              IF X = -1.5 THEN
200
                                   FAILED ("CASE C1 : WRONG PROCEDURE" &
201
                                           " CALLED (A)");
202
                              ELSIF X /= 1.5 THEN
203
                                   FAILED ("CASE C1 : WRONG VALUE " &
204
                                           "PASSED (A)");
205
                              END IF;
206
                         END PROC1;
207
                    BEGIN
208
                         NULL;
209
                    END P1;
210
 
211
                    PROCEDURE PROC2 IS
212
                    BEGIN
213
                         PROC1 (1.5);
214
                    END PROC2;
215
 
216
                    PROCEDURE PROC1 (X : FLOAT) IS
217
                    BEGIN
218
                         IF X = 1.5 THEN
219
                              FAILED ("CASE C1 : WRONG PROCEDURE" &
220
                                      " CALLED (B)");
221
                         ELSIF X /= -1.5 THEN
222
                              FAILED ("CASE C1 : WRONG VALUE " &
223
                                      "PASSED (B)");
224
                         END IF;
225
                    END PROC1;
226
 
227
               BEGIN
228
 
229
                    PROC2;
230
                    PROC1 (-1.5);
231
 
232
               END CASE_C1;
233
 
234
     CASE_C2 : DECLARE
235
 
236
                    PACKAGE P1 IS
237
                         X : INTEGER := 15;
238
                    END P1;
239
 
240
                    USE P1;
241
 
242
                    A : INTEGER := X;
243
 
244
                    X : BOOLEAN := TRUE;
245
 
246
                    B : BOOLEAN := X;
247
 
248
               BEGIN
249
 
250
                    IF A /= IDENT_INT(15) THEN
251
                         FAILED ("CASE C2 : VARIABLE A DOES NOT " &
252
                                 "CONTAIN THE CORRECT VALUE");
253
                    END IF;
254
                    IF B /= IDENT_BOOL(TRUE) THEN
255
                         FAILED ("CASE C2 : VARIABLE B DOES NOT " &
256
                                 "CONTAIN THE CORRECT VALUE");
257
                    END IF;
258
 
259
               END CASE_C2;
260
 
261
          END CASE_C;
262
 
263
     END;
264
 
265
     RESULT;
266
 
267
END C84002A;

powered by: WebSVN 2.1.0

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