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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c6/] [c67002d.ada] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- C67002D.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 ALL OPERATOR SYMBOLS CAN BE USED IN (OVERLOADED)
26
-- FUNCTION SPECIFICATIONS WITH THE REQUIRED NUMBER OF PARAMETERS.
27
-- THIS TEST CHECKS GENERIC INSTANTIATIONS FOR THESE FUNCTIONS.
28
--   SUBTESTS ARE:
29
--        (A) THROUGH (P): "=", "AND", "OR", "XOR", "<", "<=",
30
--             ">", ">=", "&", "*", "/", "MOD", "REM", "**", "+", "-",
31
--             RESPECTIVELY.  ALL OF THESE HAVE TWO PARAMETERS.
32
--        (Q), (R), (S), AND (T): "+", "-", "NOT", "ABS", RESPECTIVELY,
33
--             WITH ONE PARAMETER.
34
 
35
-- CPP 6/25/84
36
 
37
WITH REPORT;  USE REPORT;
38
PROCEDURE C67002D IS
39
 
40
     GENERIC
41
          TYPE ELEMENT IS (<>);
42
     FUNCTION TWO_PARAMS (I1, I2 : ELEMENT) RETURN CHARACTER;
43
     FUNCTION TWO_PARAMS (I1, I2 : ELEMENT) RETURN CHARACTER IS
44
     BEGIN
45
          IF I1 > I2 THEN
46
               RETURN 'G';
47
          ELSE RETURN 'L';
48
          END IF;
49
     END TWO_PARAMS;
50
 
51
     GENERIC
52
          TYPE ELEMENT IS (<>);
53
     FUNCTION ONE_PARAM (I1 : ELEMENT) RETURN CHARACTER;
54
     FUNCTION ONE_PARAM (I1 : ELEMENT) RETURN CHARACTER IS
55
     BEGIN
56
          IF I1 < ELEMENT'VAL(IDENT_INT(0)) THEN
57
               RETURN 'N';
58
          ELSE RETURN 'P';
59
          END IF;
60
     END ONE_PARAM;
61
 
62
BEGIN
63
     TEST ("C67002D", "USE OF OPERATOR SYMBOLS IN " &
64
           "(OVERLOADED) FUNCTION SPECIFICATIONS");
65
 
66
     -------------------------------------------------
67
 
68
     DECLARE -- (A)
69
          GENERIC
70
               TYPE LP IS LIMITED PRIVATE;
71
               WITH FUNCTION ">" (L, R : LP) RETURN BOOLEAN IS <>;
72
          PACKAGE PKG IS
73
               LP1, LP2 : LP;
74
               FUNCTION "=" (LPA, LPB : LP) RETURN BOOLEAN;
75
          END PKG;
76
 
77
          PACKAGE BODY PKG IS
78
               FUNCTION "=" (LPA, LPB : LP) RETURN BOOLEAN IS
79
               BEGIN
80
                    RETURN LPA > LPB;
81
               END "=";
82
          END PKG;
83
 
84
     BEGIN -- (A)
85
          DECLARE
86
               PACKAGE PACK IS NEW PKG (LP => INTEGER);
87
               USE PACK;
88
               FUNCTION "=" (L, R : INTEGER) RETURN BOOLEAN
89
                    RENAMES PACK."=";
90
          BEGIN
91
               LP1 := IDENT_INT(7);
92
               LP2 := IDENT_INT(8);
93
               IF (LP1 = LP2) OR NOT (LP2 = LP1) OR
94
                  (LP1 = LP1) OR (LP2 /= LP1) THEN
95
                    FAILED ("OVERLOADING OF ""="" OPERATOR DEFECTIVE");
96
               END IF;
97
          END;
98
     END; -- (A)
99
 
100
     -------------------------------------------------
101
 
102
     DECLARE -- (B)
103
          FUNCTION "AND" IS NEW TWO_PARAMS
104
               (ELEMENT => INTEGER);
105
 
106
     BEGIN -- (B)
107
          IF (IDENT_INT (10) AND 1) /= 'G' OR
108
             (5 AND 10) /= 'L' THEN
109
               FAILED ("OVERLOADING OF ""AND"" OPERATOR DEFECTIVE");
110
          END IF;
111
     END; -- (B)
112
 
113
     -------------------------------------------------
114
 
115
     DECLARE -- (C)
116
          FUNCTION "OR" IS NEW TWO_PARAMS
117
               (ELEMENT => INTEGER);
118
 
119
     BEGIN -- (C)
120
          IF (IDENT_INT (10) OR 1) /= 'G' OR
121
             (5 OR 10) /= 'L' THEN
122
               FAILED ("OVERLOADING OF ""OR"" OPERATOR DEFECTIVE");
123
          END IF;
124
     END; -- (C)
125
 
126
     -------------------------------------------------
127
 
128
     DECLARE -- (D)
129
          FUNCTION "XOR" IS NEW TWO_PARAMS
130
               (ELEMENT => INTEGER);
131
 
132
     BEGIN -- (D)
133
          IF (IDENT_INT (10) XOR 1) /= 'G' OR
134
             (5 XOR 10) /= 'L' THEN
135
               FAILED ("OVERLOADING OF ""XOR"" OPERATOR DEFECTIVE");
136
          END IF;
137
     END; -- (D)
138
 
139
     -------------------------------------------------
140
 
141
     DECLARE -- (E)
142
          FUNCTION "<" IS NEW TWO_PARAMS
143
               (ELEMENT => INTEGER);
144
 
145
     BEGIN -- (E)
146
          IF (IDENT_INT (10) < 1) /= 'G' OR
147
             (5 < 10) /= 'L' THEN
148
               FAILED ("OVERLOADING OF ""<"" OPERATOR DEFECTIVE");
149
          END IF;
150
     END; -- (E)
151
 
152
     -------------------------------------------------
153
 
154
     DECLARE -- (F)
155
          FUNCTION "<=" IS NEW TWO_PARAMS
156
               (ELEMENT => INTEGER);
157
 
158
     BEGIN -- (F)
159
          IF (IDENT_INT (10) <= 1) /= 'G' OR
160
             (5 <= 10) /= 'L' THEN
161
               FAILED ("OVERLOADING OF ""<="" OPERATOR DEFECTIVE");
162
          END IF;
163
     END; -- (F)
164
 
165
     -------------------------------------------------
166
 
167
     DECLARE -- (G)
168
          FUNCTION ">" IS NEW TWO_PARAMS
169
               (ELEMENT => INTEGER);
170
 
171
     BEGIN -- (G)
172
          IF (IDENT_INT (10) > 1) /= 'G' OR
173
             (5 > 10) /= 'L' THEN
174
               FAILED ("OVERLOADING OF "">"" OPERATOR DEFECTIVE");
175
          END IF;
176
     END; -- (G)
177
 
178
     -------------------------------------------------
179
 
180
     DECLARE -- (H)
181
          FUNCTION ">=" IS NEW TWO_PARAMS
182
               (ELEMENT => INTEGER);
183
 
184
     BEGIN -- (H)
185
          IF (IDENT_INT (10) >= 1) /= 'G' OR
186
             (5 >= 10) /= 'L' THEN
187
               FAILED ("OVERLOADING OF "">="" OPERATOR DEFECTIVE");
188
          END IF;
189
     END; -- (H)
190
 
191
     -------------------------------------------------
192
 
193
     DECLARE -- (I)
194
          FUNCTION "&" IS NEW TWO_PARAMS
195
               (ELEMENT => INTEGER);
196
 
197
     BEGIN -- (I)
198
          IF (IDENT_INT (10) & 1) /= 'G' OR
199
             (5 & 10) /= 'L' THEN
200
               FAILED ("OVERLOADING OF ""&"" OPERATOR DEFECTIVE");
201
          END IF;
202
     END; -- (I)
203
 
204
     -------------------------------------------------
205
 
206
     DECLARE -- (J)
207
          FUNCTION "*" IS NEW TWO_PARAMS
208
               (ELEMENT => INTEGER);
209
 
210
     BEGIN -- (J)
211
          IF (IDENT_INT (10) * 1) /= 'G' OR
212
             (5 * 10) /= 'L' THEN
213
               FAILED ("OVERLOADING OF ""*"" OPERATOR DEFECTIVE");
214
          END IF;
215
     END; -- (J)
216
 
217
     -------------------------------------------------
218
 
219
     DECLARE -- (K)
220
          FUNCTION "/" IS NEW TWO_PARAMS
221
               (ELEMENT => INTEGER);
222
 
223
     BEGIN -- (K)
224
          IF (IDENT_INT (10) / 1) /= 'G' OR
225
             (5 / 10) /= 'L' THEN
226
               FAILED ("OVERLOADING OF ""/"" OPERATOR DEFECTIVE");
227
          END IF;
228
     END; -- (K)
229
 
230
     -------------------------------------------------
231
 
232
     DECLARE -- (L)
233
          FUNCTION "MOD" IS NEW TWO_PARAMS
234
               (ELEMENT => INTEGER);
235
 
236
     BEGIN -- (L)
237
          IF (IDENT_INT (10) MOD 1) /= 'G' OR
238
             (5 MOD 10) /= 'L' THEN
239
               FAILED ("OVERLOADING OF ""MOD"" OPERATOR DEFECTIVE");
240
          END IF;
241
     END; -- (L)
242
 
243
     -------------------------------------------------
244
 
245
     DECLARE -- (M)
246
          FUNCTION "REM" IS NEW TWO_PARAMS
247
               (ELEMENT => INTEGER);
248
 
249
     BEGIN -- (M)
250
          IF (IDENT_INT (10) REM 1) /= 'G' OR
251
             (5 REM 10) /= 'L' THEN
252
               FAILED ("OVERLOADING OF ""REM"" OPERATOR DEFECTIVE");
253
          END IF;
254
     END; -- (M)
255
 
256
     -------------------------------------------------
257
 
258
     DECLARE -- (N)
259
          FUNCTION "**" IS NEW TWO_PARAMS
260
               (ELEMENT => INTEGER);
261
 
262
     BEGIN -- (N)
263
          IF (IDENT_INT (10) ** 1) /= 'G' OR
264
             (5 ** 10) /= 'L' THEN
265
               FAILED ("OVERLOADING OF ""**"" OPERATOR DEFECTIVE");
266
          END IF;
267
     END; -- (N)
268
 
269
     -------------------------------------------------
270
 
271
     DECLARE -- (O)
272
          FUNCTION "+" IS NEW TWO_PARAMS
273
               (ELEMENT => INTEGER);
274
 
275
     BEGIN -- (O)
276
          IF (IDENT_INT (10) + 1) /= 'G' OR
277
             (5 + 10) /= 'L' THEN
278
               FAILED ("OVERLOADING OF ""+"" OPERATOR DEFECTIVE");
279
          END IF;
280
     END; -- (O)
281
 
282
     -------------------------------------------------
283
 
284
     DECLARE -- (P)
285
          FUNCTION "-" IS NEW TWO_PARAMS
286
               (ELEMENT => INTEGER);
287
 
288
     BEGIN -- (P)
289
          IF (IDENT_INT (10) - 1) /= 'G' OR
290
             (5 - 10) /= 'L' THEN
291
               FAILED ("OVERLOADING OF ""-"" OPERATOR DEFECTIVE");
292
          END IF;
293
     END; -- (P)
294
 
295
     -------------------------------------------------
296
 
297
     DECLARE -- (Q)
298
          FUNCTION "+" IS NEW ONE_PARAM
299
               (ELEMENT => INTEGER);
300
 
301
     BEGIN -- (Q)
302
          IF (+ IDENT_INT(25) /= 'P') OR
303
             (+ (0-25) /= 'N') THEN
304
               FAILED ("OVERLOADING OF ""+"" " &
305
                       "OPERATOR (ONE OPERAND) DEFECTIVE");
306
          END IF;
307
     END; -- (Q)
308
 
309
     -------------------------------------------------
310
 
311
     DECLARE -- (R)
312
          FUNCTION "-" IS NEW ONE_PARAM
313
               (ELEMENT => INTEGER);
314
 
315
     BEGIN -- (R)
316
          IF (- IDENT_INT(25) /= 'P') OR
317
             (- (0-25) /= 'N') THEN
318
               FAILED ("OVERLOADING OF ""-"" " &
319
                       "OPERATOR (ONE OPERAND) DEFECTIVE");
320
          END IF;
321
     END; -- (R)
322
 
323
     -------------------------------------------------
324
 
325
     DECLARE -- (S)
326
          FUNCTION "NOT" IS NEW ONE_PARAM
327
               (ELEMENT => INTEGER);
328
 
329
     BEGIN -- (S)
330
          IF (NOT IDENT_INT(25) /= 'P') OR
331
             (NOT (0-25) /= 'N') THEN
332
               FAILED ("OVERLOADING OF ""NOT"" " &
333
                       "OPERATOR (ONE OPERAND) DEFECTIVE");
334
          END IF;
335
     END; -- (S)
336
 
337
     -------------------------------------------------
338
 
339
     DECLARE -- (T)
340
          FUNCTION "ABS" IS NEW ONE_PARAM
341
               (ELEMENT => INTEGER);
342
 
343
     BEGIN -- (T)
344
          IF (ABS IDENT_INT(25) /= 'P') OR
345
             (ABS (0-25) /= 'N') THEN
346
               FAILED ("OVERLOADING OF ""ABS"" " &
347
                       "OPERATOR (ONE OPERAND) DEFECTIVE");
348
          END IF;
349
     END; -- (T)
350
 
351
     -------------------------------------------------
352
 
353
     RESULT;
354
END C67002D;

powered by: WebSVN 2.1.0

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