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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CC3012A.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 GENERIC INSTANCES MAY BE OVERLOADED.
26
 
27
-- CHECK THAT THEY MAY OVERLOAD PREVIOUSLY DECLARED SUBPROGRAMS AND
28
-- ENUMERATION LITERALS.
29
 
30
-- DAT 9/16/81
31
-- SPS 10/19/82
32
-- SPS 2/8/83
33
-- PWN 11/30/94 REMOVED PART OF TEST INVALID FOR ADA 9X.
34
 
35
 
36
WITH REPORT; USE REPORT;
37
 
38
PROCEDURE CC3012A IS
39
BEGIN
40
     TEST ("CC3012A", "CHECK THAT GENERIC INSTANCES MAY OVERLOAD " &
41
                      "OTHER IDENTIFIERS");
42
 
43
     DECLARE
44
          GENERIC
45
               TYPE T IS ( <> );
46
               V : IN T;
47
          PROCEDURE GP (X : IN OUT T);
48
 
49
          GENERIC
50
               TYPE T IS ( <> );
51
          FUNCTION LESS (X, Y : T) RETURN BOOLEAN;
52
 
53
          GENERIC
54
               TYPE T IS ( <> );
55
          FUNCTION PLUS (X, Y : T) RETURN T;
56
 
57
          GENERIC
58
               TYPE T IS PRIVATE;
59
               Z : T;
60
          FUNCTION F1  RETURN T;
61
 
62
          TYPE DC IS NEW CHARACTER RANGE IDENT_CHAR ('A') .. 'Z';
63
          TYPE DI IS NEW INTEGER;
64
          TYPE ENUM IS (E1, E2, E3, E4);
65
 
66
          VC : CHARACTER := 'A';
67
          VI : INTEGER := 5;
68
          VB : BOOLEAN := TRUE;
69
          VE : ENUM := E2;
70
 
71
          TYPE DENUM IS NEW ENUM RANGE E2 .. ENUM'LAST;
72
 
73
          VDE : DENUM := E4;
74
          VDC : DC := 'A';
75
          VDI : DI := 7;
76
 
77
          PROCEDURE GP (X : IN OUT T) IS
78
          BEGIN
79
               X := V;
80
          END GP;
81
 
82
          FUNCTION LESS (X, Y : T) RETURN BOOLEAN IS
83
          BEGIN
84
               RETURN FALSE;
85
          END LESS;
86
 
87
          FUNCTION PLUS (X, Y : T) RETURN T IS
88
          BEGIN
89
               RETURN T'FIRST;
90
          END PLUS;
91
 
92
          FUNCTION F1 RETURN T IS
93
          BEGIN
94
               RETURN Z;
95
          END F1;
96
 
97
          FUNCTION E5 RETURN INTEGER IS
98
          BEGIN
99
               RETURN 1;
100
          END E5;
101
 
102
          PACKAGE PKG IS
103
 
104
               PROCEDURE P IS NEW GP (CHARACTER, 'Q');
105
               PROCEDURE P IS NEW GP (INTEGER, -14);
106
               PROCEDURE P IS NEW GP (BOOLEAN, FALSE);
107
               PROCEDURE P IS NEW GP (ENUM, E4);
108
               PROCEDURE P IS NEW GP (DC, 'W');
109
               PROCEDURE P IS NEW GP (DI, -33);
110
               PROCEDURE P IS NEW GP (DENUM, E2);
111
 
112
               FUNCTION "<" IS NEW LESS (CHARACTER);
113
               FUNCTION "<" IS NEW LESS (INTEGER);
114
               FUNCTION "<" IS NEW LESS (BOOLEAN);
115
               FUNCTION "<" IS NEW LESS (ENUM);
116
               FUNCTION "<" IS NEW LESS (DC);
117
               FUNCTION "<" IS NEW LESS (DI);
118
               -- NOT FOR DENUM.
119
 
120
               FUNCTION "+" IS NEW PLUS (CHARACTER);
121
               FUNCTION "+" IS NEW PLUS (INTEGER);
122
               FUNCTION "+" IS NEW PLUS (BOOLEAN);
123
               FUNCTION "+" IS NEW PLUS (ENUM);
124
               FUNCTION "+" IS NEW PLUS (DC);
125
               -- NOT FOR DI.
126
               FUNCTION "+" IS NEW PLUS (DENUM);
127
 
128
               FUNCTION E2 IS NEW F1 (BOOLEAN, FALSE);
129
               FUNCTION E5 IS NEW F1 (DC, 'M');
130
 
131
          END PKG;
132
 
133
          PACKAGE BODY PKG IS
134
          BEGIN
135
               P (VC);
136
               P (VI);
137
               P (VB);
138
               P (VE);
139
               P (X => VDE);
140
               P (X => VDC);
141
               P (X => VDI);
142
 
143
               IF VC /= 'Q' THEN
144
                    FAILED ("OVERLOADED PROCEDURE - 1");
145
               END IF;
146
 
147
               IF VI /= -14 THEN
148
                    FAILED ("OVERLOADED PROCEDURE - 2");
149
               END IF;
150
 
151
               IF VB /= FALSE THEN
152
                    FAILED ("OVERLOADED PROCEDURE - 3");
153
               END IF;
154
 
155
               IF VE /= E4 THEN
156
                    FAILED ("OVERLOADED PROCEDURE - 4");
157
               END IF;
158
 
159
               IF VDE /= E2 THEN
160
                    FAILED ("OVERLOADED PROCEDURE - 5");
161
               END IF;
162
 
163
               IF VDC /= 'W' THEN
164
                    FAILED ("OVERLOADED PROCEDURE - 6");
165
               END IF;
166
 
167
               IF VDI /= -33 THEN
168
                    FAILED ("OVERLOADED PROCEDURE - 7");
169
               END IF;
170
 
171
               IF VC  < ASCII.DEL THEN
172
                    FAILED ("OVERLOADED LESS THAN - 1");
173
               END IF;
174
 
175
               IF VI < 1E3 THEN
176
                    FAILED ("OVERLOADED LESS THAN - 2");
177
               END IF;
178
 
179
               IF FALSE < TRUE THEN
180
                    FAILED ("OVERLOADED LESS THAN - 3");
181
               END IF;
182
 
183
               IF E1 < VE THEN
184
                    FAILED ("OVERLOADED LESS THAN - 4");
185
               END IF;
186
 
187
               IF VDC < 'Z' THEN
188
                    FAILED ("OVERLOADED LESS THAN - 5");
189
               END IF;
190
 
191
               IF VDI < 0 THEN
192
                    FAILED ("OVERLOADED LESS THAN - 6");
193
               END IF;
194
 
195
 
196
               IF -14 + 5 /= -9 THEN
197
                    FAILED ("OVERLOADED PLUS - 2");
198
               END IF;
199
 
200
               IF VI + 5 /= INTEGER'FIRST THEN
201
                    FAILED ("OVERLOADED PLUS - 3");
202
               END IF;
203
 
204
               IF VB + TRUE /= FALSE THEN
205
                    FAILED ("OVERLOADED PLUS - 4");
206
               END IF;
207
 
208
               IF VE + E2 /= E1 THEN
209
                    FAILED ("OVERLOADED PLUS - 5");
210
               END IF;
211
 
212
               IF DENUM'(E3) + E2 /= E2 THEN
213
                    FAILED ("OVERLOADED PLUS - 6");
214
               END IF;
215
 
216
               IF  VDC + 'B' /= 'A' THEN
217
                    FAILED ("OVERLOADED PLUS - 7");
218
               END IF;
219
 
220
               IF VDI + 14 /= -19 THEN       -- -33 + 14
221
                    FAILED ("OVERLOADED PLUS - 8");
222
               END IF;
223
 
224
               VI := E5;
225
               VDC := E5;
226
               VE := E2;
227
               VB := E2;
228
               IF VI /= 1 OR
229
                  VDC /= 'M' OR
230
                  VE /= ENUM'VAL(IDENT_INT(1)) OR
231
                  VB /= FALSE THEN
232
                    FAILED ("OVERLOADING OF ENUMERATION LITERALS " &
233
                            "AND PREDEFINED SUBPROGRAMS");
234
               END IF;
235
          END PKG;
236
     BEGIN
237
          DECLARE
238
               USE PKG;
239
          BEGIN
240
               IF NOT (VI + 5 < 11) THEN
241
               FAILED ("INCORRECT VISIBILITY OF GENERIC OVERLOADING");
242
               END IF;
243
          END;
244
     END;
245
 
246
     RESULT;
247
END CC3012A;

powered by: WebSVN 2.1.0

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