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