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/] [c6/] [c67003f.ada] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C67003F.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 THE PREDEFINED OPERATORS FOR THE PREDEFINED TYPES CAN BE 
26
--   REDEFINED.
27
-- CHECK THAT THE REDEFINED OPERATOR IS INVOKED WHEN INFIX OR PREFIX
28
--   NOTATION IS USED.
29
 
30
-- HISTORY:
31
--   WMC 03/21/92   TEST CREATED FROM CONSOLIDATION OF C67003[A-E].ADA
32
 
33
 
34
WITH REPORT;
35
 
36
PROCEDURE C67003F IS
37
 
38
     USE REPORT;
39
 
40
BEGIN
41
 
42
     TEST ("C67003F", "CHECK THAT REDEFINITION OF " &
43
           "OPERATORS FOR PREDEFINED TYPES WORKS");
44
 
45
     DECLARE     -- INTEGER OPERATORS.
46
 
47
          -- INTEGER INFIX OPERATORS.
48
 
49
          FUNCTION "*" (X, Y : INTEGER) RETURN INTEGER IS
50
          BEGIN
51
               IF X /= Y THEN
52
                    RETURN 1;
53
               ELSE RETURN 0;
54
               END IF;
55
          END "*";
56
 
57
          FUNCTION "+" (X, Y : INTEGER) RETURN INTEGER IS
58
          BEGIN
59
               IF X /= Y THEN
60
                    RETURN 2;
61
               ELSE RETURN 0;
62
               END IF;
63
          END "+";
64
 
65
          FUNCTION "REM" (X, Y : INTEGER) RETURN INTEGER IS
66
          BEGIN
67
               IF X /= Y THEN
68
                    RETURN 3;
69
               ELSE RETURN 0;
70
               END IF;
71
          END "REM";
72
 
73
          -- INTEGER PREFIX OPERATORS.
74
 
75
          FUNCTION "+" (X : INTEGER) RETURN INTEGER IS
76
          BEGIN
77
               IF X /= 0 THEN
78
                    RETURN 4;
79
               ELSE RETURN 0;
80
               END IF;
81
          END "+";
82
 
83
          FUNCTION "ABS" (X : INTEGER) RETURN INTEGER IS
84
          BEGIN
85
               IF X /= 0 THEN
86
                    RETURN 5;
87
               ELSE RETURN 0;
88
               END IF;
89
          END "ABS";
90
 
91
          -- INTEGER RELATIONAL OPERATOR.
92
 
93
          FUNCTION "<" (X, Y : INTEGER) RETURN BOOLEAN IS
94
          BEGIN
95
               RETURN X = Y;
96
          END "<";
97
 
98
     BEGIN
99
 
100
          IF IDENT_INT (3) * IDENT_INT (5) /= 1 THEN
101
               FAILED ("REDEFINITION OF INTEGER ""*"" IS DEFECTIVE");
102
          END IF;
103
 
104
          IF IDENT_INT (1) + IDENT_INT (30) /= 2 THEN
105
               FAILED ("REDEFINITION OF INTEGER ""+"" IS DEFECTIVE");
106
          END IF;
107
 
108
          IF IDENT_INT (7) REM IDENT_INT (8) /= 3 THEN
109
               FAILED ("REDEFINITION OF ""REM"" IS DEFECTIVE");
110
          END IF;
111
 
112
          IF + (IDENT_INT (10)) /= 4 THEN
113
               FAILED ("REDEFINITION OF INTEGER UNARY ""+"" IS DEFECTIVE");
114
          END IF;
115
 
116
          IF ABS (IDENT_INT (2)) /= 5 THEN
117
               FAILED ("REDEFINITION OF INTEGER ""ABS"" IS DEFECTIVE");
118
          END IF;
119
 
120
          IF IDENT_INT (7) < IDENT_INT (8) THEN
121
               FAILED ("REDEFINITION OF INTEGER ""<"" IS DEFECTIVE");
122
          END IF;
123
 
124
     END;
125
 
126
     DECLARE   -- FLOAT OPERATORS.
127
 
128
          -- NOTE THAT ALL LITERAL VALUES USED SHOULD BE
129
          --   REPRESENTABLE EXACTLY.
130
 
131
          FUNCTION IDENT_FLOAT (X : FLOAT) RETURN FLOAT IS
132
             I : INTEGER := INTEGER (X);
133
          BEGIN
134
             IF EQUAL (I, I) THEN          -- ALWAYS EQUAL.
135
                  RETURN X;
136
             END IF;
137
             RETURN 0.0;
138
          END IDENT_FLOAT;
139
 
140
          -- FLOAT INFIX OPERATORS.
141
 
142
          FUNCTION "-" (X, Y : FLOAT) RETURN FLOAT IS
143
          BEGIN
144
               IF X /= Y THEN
145
                    RETURN 1.0;
146
               ELSE RETURN 0.0;
147
               END IF;
148
          END "-";
149
 
150
          FUNCTION "/" (X, Y : FLOAT) RETURN FLOAT IS
151
          BEGIN
152
               IF X /= Y THEN
153
                    RETURN 2.0;
154
               ELSE RETURN 0.0;
155
               END IF;
156
          END "/";
157
 
158
          FUNCTION "**" (X : FLOAT; Y : INTEGER) RETURN FLOAT IS
159
          BEGIN
160
               IF INTEGER (X) /= Y THEN
161
                    RETURN 3.0;
162
               ELSE RETURN 0.0;
163
               END IF;
164
          END "**";
165
 
166
          -- FLOAT PREFIX OPERATOR.
167
 
168
          FUNCTION "-" (X : FLOAT) RETURN FLOAT IS
169
          BEGIN
170
               IF X /= 0.0 THEN
171
                    RETURN 4.0;
172
               ELSE RETURN 0.0;
173
               END IF;
174
          END "-";
175
 
176
          -- FLOAT RELATIONAL OPERATOR.
177
 
178
          FUNCTION "<=" (X, Y : FLOAT) RETURN BOOLEAN IS
179
          BEGIN
180
               RETURN X = Y;
181
          END "<=";
182
 
183
     BEGIN
184
 
185
          IF IDENT_FLOAT (50.0) - IDENT_FLOAT (100.0) /= 1.0 THEN
186
               FAILED ("REDEFINITION OF FLOAT ""-"" IS DEFECTIVE");
187
          END IF;
188
 
189
          IF IDENT_FLOAT (5.0) / IDENT_FLOAT (1.0) /= 2.0 THEN
190
               FAILED ("REDEFINITION OF FLOAT ""/"" IS DEFECTIVE");
191
          END IF;
192
 
193
          IF IDENT_FLOAT (3.0) ** IDENT_INT (2) /= 3.0 THEN
194
               FAILED ("REDEFINITION OF FLOAT ""**"" IS DEFECTIVE");
195
          END IF;
196
 
197
          IF -(IDENT_FLOAT (5.0)) /= 4.0 THEN
198
               FAILED ("REDEFINITION OF FLOAT UNARY ""-"" IS DEFECTIVE");
199
          END IF;
200
 
201
          IF IDENT_FLOAT (1.0) <= IDENT_FLOAT (5.0) THEN
202
               FAILED ("REDEFINITION OF FLOAT ""<="" IS DEFECTIVE");
203
          END IF;
204
 
205
     END;
206
 
207
     DECLARE     -- BOOLEAN OPERATORS.
208
 
209
          -- BOOLEAN LOGICAL OPERATORS.
210
 
211
          FUNCTION "AND" (X, Y : BOOLEAN) RETURN BOOLEAN IS
212
          BEGIN
213
               IF X AND THEN Y THEN
214
                    RETURN FALSE;
215
               ELSE RETURN TRUE;
216
               END IF;
217
          END "AND";
218
 
219
          FUNCTION "XOR" (X, Y : BOOLEAN) RETURN BOOLEAN IS
220
          BEGIN
221
               RETURN X = Y;
222
          END "XOR";
223
 
224
          -- BOOLEAN RELATIONAL OPERATOR.
225
 
226
          FUNCTION ">" (X, Y : BOOLEAN) RETURN BOOLEAN IS
227
          BEGIN
228
               RETURN X = Y;
229
          END ">";
230
 
231
     BEGIN
232
 
233
          IF IDENT_BOOL (TRUE) AND IDENT_BOOL (TRUE) THEN
234
               FAILED ("REDEFINITION OF ""AND"" IS DEFECTIVE");
235
          END IF;
236
 
237
          IF IDENT_BOOL (TRUE) XOR IDENT_BOOL (FALSE) THEN
238
               FAILED ("REDEFINITION OF ""XOR"" IS DEFECTIVE");
239
          END IF;
240
 
241
          IF IDENT_BOOL (TRUE) > IDENT_BOOL (FALSE) THEN
242
               FAILED ("REDEFINITION OF BOOLEAN "">"" IS DEFECTIVE");
243
          END IF;
244
 
245
     END;
246
 
247
     DECLARE     -- STRING OPERATORS.
248
 
249
          S1 : STRING (1..2) := "A" & IDENT_CHAR ('B');
250
          S2 : STRING (1..2) := "C" & IDENT_CHAR ('D');
251
 
252
          FUNCTION "&" (X, Y : STRING) RETURN STRING IS
253
               Z : STRING (1 .. X'LENGTH + Y'LENGTH);
254
          BEGIN
255
               Z (1 .. Y'LENGTH) := Y;
256
               Z (Y'LENGTH + 1 .. Z'LAST) := X;
257
               RETURN Z;
258
          END "&";
259
 
260
          FUNCTION "&" (X : CHARACTER; Y : STRING) RETURN STRING IS
261
               Z : STRING (1 .. Y'LENGTH + 1);
262
          BEGIN
263
               Z (1 .. Y'LENGTH) := Y;
264
               Z (Z'LAST) := X;
265
               RETURN Z;
266
          END "&";
267
 
268
          -- STRING RELATIONAL OPERATOR.
269
 
270
          FUNCTION ">=" (X, Y : STRING) RETURN BOOLEAN IS
271
          BEGIN
272
               RETURN X = Y;
273
          END ">=";
274
 
275
     BEGIN
276
 
277
          IF S1 & S2 /= "CDAB" THEN
278
               FAILED ("BAD REDEFINITION OF ""&"" (S,S)");
279
          END IF;
280
 
281
          IF IDENT_CHAR ('C') & S1 /= "ABC" THEN
282
               FAILED ("BAD REDEFINITION OF ""&"" (C,S)");
283
          END IF;
284
 
285
          IF S2 >= S1 THEN
286
               FAILED ("BAD REDEFINITION OF STRING "">=""");
287
          END IF;
288
 
289
     END;
290
 
291
     DECLARE      -- CHARACTER OPERATORS.
292
 
293
          -- CHARACTER RELATIONAL OPERATORS.
294
 
295
          FUNCTION ">" (X, Y : CHARACTER) RETURN BOOLEAN IS
296
          BEGIN
297
               RETURN X = Y;
298
          END ">";
299
 
300
          FUNCTION "<=" (X, Y : CHARACTER) RETURN BOOLEAN IS
301
          BEGIN
302
               RETURN X = Y;
303
          END "<=";
304
 
305
     BEGIN
306
 
307
          IF IDENT_CHAR ('C') > IDENT_CHAR ('B') THEN
308
               FAILED ("REDEFINITION OF CHARACTER "">"" IS DEFECTIVE");
309
          END IF;
310
 
311
          IF IDENT_CHAR ('A') <= IDENT_CHAR ('E') THEN
312
               FAILED ("REDEFINITION OF CHARACTER ""<="" IS DEFECTIVE");
313
          END IF;
314
 
315
     END;
316
 
317
     RESULT;
318
 
319
END C67003F;

powered by: WebSVN 2.1.0

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