1-- C45503C.DEP
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-- OBJECTIVE:
26--     CHECK THAT 'REM' AND 'MOD' YIELD CORRECT RESULTS WHEN THE
27--     OPERANDS ARE OF PREDEFINED TYPE LONG_INTEGER.
28
29-- APPLICABILITY CRITERIA:
30--     THIS TEST IS APPLICABLE TO THOSE IMPLEMENTATIONS WHICH SUPPORT
31--     LONG_INTEGER.
32
33--     IF "LONG_INTEGER" IS NOT SUPPORTED, THEN THE DECLARATION OF
34--     "CHECK_LONG" MUST BE REJECTED.
35
36-- HISTORY:
37--     RJW 09/01/86 CREATED ORIGINAL TEST.
38--     DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
39
40WITH REPORT; USE REPORT;
41PROCEDURE C45503C IS
42
43     CHECK_LONG : LONG_INTEGER;                      -- N/A => ERROR.
44
45     FUNCTION IDENT (L : LONG_INTEGER) RETURN LONG_INTEGER IS
46     BEGIN
47          IF EQUAL (3, 3) THEN
48               RETURN L;
49          ELSE
50               RETURN 0;
51          END IF;
52     END IDENT;
53
54BEGIN
55     TEST ( "C45503C", "CHECK THAT 'REM' AND 'MOD' YIELD CORRECT " &
56                       "RESULTS WHEN THE OPERANDS ARE OF PREDEFINED " &
57                       "TYPE LONG_INTEGER" );
58
59     DECLARE
60          I0  : LONG_INTEGER := 0;
61          I1  : LONG_INTEGER := 1;
62          I2  : LONG_INTEGER := 2;
63          I3  : LONG_INTEGER := 3;
64          I4  : LONG_INTEGER := 4;
65          I5  : LONG_INTEGER := 5;
66          I10 : LONG_INTEGER := 10;
67          I11 : LONG_INTEGER := 11;
68          I12 : LONG_INTEGER := 12;
69          I13 : LONG_INTEGER := 13;
70          I14 : LONG_INTEGER := 14;
71          N1  : LONG_INTEGER := -1;
72          N2  : LONG_INTEGER := -2;
73          N3  : LONG_INTEGER := -3;
74          N4  : LONG_INTEGER := -4;
75          N5  : LONG_INTEGER := -5;
76          N10 : LONG_INTEGER := -10;
77          N11 : LONG_INTEGER := -11;
78          N12 : LONG_INTEGER := -12;
79          N13 : LONG_INTEGER := -13;
80          N14 : LONG_INTEGER := -14;
81
82     BEGIN
83          IF I10 REM I5 /= I0 THEN
84               FAILED ( "INCORRECT RESULT FOR I10 REM I5" );
85          END IF;
86
87          IF IDENT (I11) REM IDENT (I5) /= I1 THEN
88               FAILED ( "INCORRECT RESULT FOR IDENT (I11) REM " &
89                        "IDENT (I5)" );
90          END IF;
91
92          IF I12 REM I5 /= I2 THEN
93               FAILED ( "INCORRECT RESULT FOR I12 REM I5" );
94          END IF;
95
96          IF "REM" (LEFT => I12, RIGHT => I5) /= I2 THEN
97               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => I12, " &
98                        "RIGHT => I5)" );
99          END IF;
100
101          IF IDENT (I13) REM IDENT (I5) /= I3 THEN
102               FAILED ( "INCORRECT RESULT FOR IDENT (I13) REM " &
103                        "IDENT (I5)" );
104          END IF;
105
106          IF I14 REM I5 /= I4 THEN
107               FAILED ( "INCORRECT RESULT FOR I14 REM I5" );
108          END IF;
109
110          IF IDENT (I10) REM IDENT (N5) /= I0 THEN
111               FAILED ( "INCORRECT RESULT FOR IDENT (I10) REM " &
112                        "IDENT (N5)" );
113          END IF;
114
115          IF "REM" (LEFT => IDENT (I10), RIGHT => IDENT (N5))
116                   /= I0 THEN
117               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => " &
118                        "IDENT (I10), RIGHT => IDENT (N5))" );
119          END IF;
120
121          IF I11 REM N5 /= I1 THEN
122               FAILED ( "INCORRECT RESULT FOR I11 REM N5" );
123          END IF;
124
125          IF IDENT (I12) REM IDENT (N5) /= I2 THEN
126               FAILED ( "INCORRECT RESULT FOR IDENT (I12) REM " &
127                        "IDENT (N5)" );
128          END IF;
129
130          IF I13 REM N5 /= I3 THEN
131               FAILED ( "INCORRECT RESULT FOR I13 REM N5" );
132          END IF;
133
134          IF "REM" (LEFT => I13, RIGHT => N5) /= I3 THEN
135               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => I13, " &
136                        "RIGHT => N5)" );
137          END IF;
138
139          IF IDENT (I14) REM IDENT (N5) /= I4 THEN
140               FAILED ( "INCORRECT RESULT FOR IDENT (I14) REM " &
141                        "IDENT (N5)" );
142          END IF;
143
144          IF N10 REM I5 /= I0 THEN
145               FAILED ( "INCORRECT RESULT FOR N10 REM I5" );
146          END IF;
147
148          IF IDENT (N11) REM IDENT (I5) /= N1 THEN
149               FAILED ( "INCORRECT RESULT FOR IDENT (N11) REM " &
150                        "IDENT (I5)" );
151          END IF;
152
153          IF "REM" (LEFT => IDENT (N11), RIGHT => IDENT (I5))
154                   /= N1 THEN
155               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => " &
156                        "IDENT (N11), RIGHT => IDENT (I5))" );
157          END IF;
158
159          IF N12 REM I5 /= N2 THEN
160               FAILED ( "INCORRECT RESULT FOR N12 REM I5" );
161          END IF;
162
163          IF IDENT (N13) REM IDENT (I5) /= N3 THEN
164               FAILED ( "INCORRECT RESULT FOR IDENT (N13) REM " &
165                        "IDENT (I5)" );
166          END IF;
167
168          IF N14 REM I5 /= N4 THEN
169               FAILED ( "INCORRECT RESULT FOR N14 REM I5" );
170          END IF;
171
172          IF "REM" (LEFT => N14, RIGHT => I5) /= N4 THEN
173               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => N14, " &
174                        "RIGHT => I5)" );
175          END IF;
176
177          IF IDENT (N10) REM IDENT (N5) /= I0 THEN
178               FAILED ( "INCORRECT RESULT FOR IDENT (N10) REM " &
179                        "IDENT (N5)" );
180          END IF;
181
182          IF N11 REM N5 /= N1 THEN
183               FAILED ( "INCORRECT RESULT FOR N11 REM N5" );
184          END IF;
185
186          IF IDENT (N12) REM IDENT (N5) /= N2 THEN
187               FAILED ( "INCORRECT RESULT FOR IDENT (N12) REM " &
188                        "IDENT (N5)" );
189          END IF;
190
191          IF "REM" (LEFT => IDENT (N12), RIGHT => IDENT (N5))
192                   /= N2 THEN
193               FAILED ( "INCORRECT RESULT FOR ""REM"" (LEFT => " &
194                        "IDENT (N12), RIGHT => IDENT (N5))" );
195          END IF;
196
197          IF N13 REM N5 /= N3 THEN
198               FAILED ( "INCORRECT RESULT FOR N13 REM N5" );
199          END IF;
200
201          IF IDENT (N14) REM IDENT (N5) /= N4 THEN
202               FAILED ( "INCORRECT RESULT FOR IDENT (N14) REM " &
203                        "IDENT (N5)" );
204          END IF;
205
206          IF I10 MOD I5 /= I0 THEN
207               FAILED ( "INCORRECT RESULT FOR I10 MOD I5" );
208          END IF;
209
210          IF IDENT (I11) MOD IDENT (I5) /= I1 THEN
211               FAILED ( "INCORRECT RESULT FOR IDENT (I11) MOD " &
212                        "IDENT (I5)" );
213          END IF;
214
215          IF I12 MOD I5 /= I2 THEN
216               FAILED ( "INCORRECT RESULT FOR I12 MOD I5" );
217          END IF;
218
219          IF "MOD" (LEFT => I12, RIGHT => I5) /= I2 THEN
220               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => I12, " &
221                        "RIGHT => I5)" );
222          END IF;
223
224          IF IDENT (I13) MOD IDENT (I5) /= I3 THEN
225               FAILED ( "INCORRECT RESULT FOR IDENT (I13) MOD " &
226                        "IDENT (I5)" );
227          END IF;
228
229          IF I14 MOD I5 /= I4 THEN
230               FAILED ( "INCORRECT RESULT FOR I14 MOD I5" );
231          END IF;
232
233          IF IDENT (I10) MOD IDENT (N5) /= I0 THEN
234               FAILED ( "INCORRECT RESULT FOR IDENT (I10) MOD " &
235                        "IDENT (N5)" );
236          END IF;
237
238          IF "MOD" (LEFT => IDENT (I10), RIGHT => IDENT (N5))
239                   /= I0 THEN
240               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => " &
241                        "IDENT (I10), RIGHT => IDENT (N5))" );
242          END IF;
243
244          IF I11 MOD N5 /= N4 THEN
245               FAILED ( "INCORRECT RESULT FOR I11 MOD N5" );
246          END IF;
247
248          IF IDENT (I12) MOD IDENT (N5) /= N3 THEN
249               FAILED ( "INCORRECT RESULT FOR IDENT (I12) MOD " &
250                        "IDENT (N5)" );
251          END IF;
252
253          IF I13 MOD N5 /= N2 THEN
254               FAILED ( "INCORRECT RESULT FOR I13 MOD N5" );
255          END IF;
256
257          IF "MOD" (LEFT => I13, RIGHT => N5) /= N2 THEN
258               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => I13, " &
259                        "RIGHT => N5)" );
260          END IF;
261
262          IF IDENT (I14) MOD IDENT (N5) /=  N1 THEN
263               FAILED ( "INCORRECT RESULT FOR IDENT (I14) MOD " &
264                        "IDENT (N5)" );
265          END IF;
266
267          IF N10 MOD I5 /= I0 THEN
268               FAILED ( "INCORRECT RESULT FOR N10 MOD I5" );
269          END IF;
270
271          IF IDENT (N11) MOD IDENT (I5) /= I4 THEN
272               FAILED ( "INCORRECT RESULT FOR IDENT (N11) MOD " &
273                        "IDENT (I5)" );
274          END IF;
275
276          IF "MOD" (LEFT => IDENT (N11), RIGHT => IDENT (I5))
277                   /= I4 THEN
278               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => " &
279                        "IDENT (N11), RIGHT => IDENT (I5))" );
280          END IF;
281
282          IF N12 MOD I5 /= I3 THEN
283               FAILED ( "INCORRECT RESULT FOR N12 MOD I5" );
284          END IF;
285
286          IF IDENT (N13) MOD IDENT (I5) /= I2 THEN
287               FAILED ( "INCORRECT RESULT FOR IDENT (N13) MOD " &
288                        "IDENT (I5)" );
289          END IF;
290
291          IF N14 MOD I5 /= I1 THEN
292               FAILED ( "INCORRECT RESULT FOR N14 MOD I5" );
293          END IF;
294
295          IF "MOD" (LEFT => N14, RIGHT => I5) /= I1 THEN
296               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => I14, " &
297                        "RIGHT => I5)" );
298          END IF;
299
300          IF IDENT (N10) MOD IDENT (N5) /= I0 THEN
301               FAILED ( "INCORRECT RESULT FOR IDENT (N10) MOD " &
302                        "IDENT (N5)" );
303          END IF;
304
305          IF N11 MOD N5 /= N1 THEN
306               FAILED ( "INCORRECT RESULT FOR N11 MOD N5" );
307          END IF;
308
309          IF IDENT (N12) MOD IDENT (N5) /= N2 THEN
310               FAILED ( "INCORRECT RESULT FOR IDENT (N12) MOD " &
311                        "IDENT (N5)" );
312          END IF;
313
314          IF "MOD" (LEFT => IDENT (N12), RIGHT => IDENT (N5))
315                   /= N2 THEN
316               FAILED ( "INCORRECT RESULT FOR ""MOD"" (LEFT => " &
317                        "IDENT (N12), RIGHT => IDENT (N5))" );
318          END IF;
319
320          IF N13 MOD N5 /= N3 THEN
321               FAILED ( "INCORRECT RESULT FOR N13 MOD N5" );
322          END IF;
323
324          IF IDENT (N14) MOD IDENT (N5) /= N4 THEN
325               FAILED ( "INCORRECT RESULT FOR IDENT (N14) MOD " &
326                        "IDENT (N5)" );
327          END IF;
328     END;
329
330     RESULT;
331END C45503C;
332