1 |
149 |
jeremybenn |
-- C45504E.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 CONSTRAINT_ERROR IS RAISED WHEN THE
|
27 |
|
|
-- SECOND OPERAND OF '/', 'MOD', OR 'REM' EQUALS ZERO, IF THE
|
28 |
|
|
-- OPERANDS ARE OF PREDEFINED TYPE SHORT_INTEGER.
|
29 |
|
|
|
30 |
|
|
-- APPLICABILITY CRITERIA:
|
31 |
|
|
-- THIS TEST IS APPLICABLE TO THOSE IMPLEMENTATIONS WHICH SUPPORT
|
32 |
|
|
-- SHORT_INTEGER.
|
33 |
|
|
|
34 |
|
|
-- IF "SHORT_INTEGER" IS NOT SUPPORTED, THEN THE DECLARATION OF
|
35 |
|
|
-- "CHECK_SHORT" MUST BE REJECTED.
|
36 |
|
|
|
37 |
|
|
-- *** NOTE: This test has been modified since ACVC version 1.11 to -- 9X
|
38 |
|
|
-- *** remove incompatibilities associated with the transition -- 9X
|
39 |
|
|
-- *** to Ada 9X. -- 9X
|
40 |
|
|
|
41 |
|
|
-- HISTORY:
|
42 |
|
|
-- RJW 09/01/86 CREATED ORIGINAL TEST.
|
43 |
|
|
-- DHH 01/13/88 ADDED APPLICABILITY CRITERIA AND STANDARD HEADER.
|
44 |
|
|
-- JRL 03/11/93 INITIALIZED VARIABLES TO DEFEAT OPTIMIZATION.
|
45 |
|
|
-- JRL 03/30/93 REMOVED NUMERIC_ERROR FROM TEST.
|
46 |
|
|
|
47 |
|
|
WITH REPORT; USE REPORT;
|
48 |
|
|
PROCEDURE C45504E IS
|
49 |
|
|
|
50 |
|
|
CHECK_SHORT : SHORT_INTEGER; -- N/A => ERROR.
|
51 |
|
|
|
52 |
|
|
I0 : SHORT_INTEGER := 1;
|
53 |
|
|
I5 : SHORT_INTEGER := 2;
|
54 |
|
|
N5 : SHORT_INTEGER := 3;
|
55 |
|
|
|
56 |
|
|
BEGIN
|
57 |
|
|
TEST ( "C45504E", "CHECK THAT CONSTRAINT_ERROR " &
|
58 |
|
|
"IS RAISED WHEN THE SECOND OPERAND OF '/', " &
|
59 |
|
|
"'MOD', OR 'REM' EQUALS ZERO, IF THE " &
|
60 |
|
|
"OPERANDS ARE OF PREDEFINED TYPE " &
|
61 |
|
|
"SHORT_INTEGER" );
|
62 |
|
|
|
63 |
|
|
IF EQUAL (3, 3) THEN
|
64 |
|
|
I0 := 0;
|
65 |
|
|
I5 := 5;
|
66 |
|
|
N5 := -5;
|
67 |
|
|
END IF;
|
68 |
|
|
|
69 |
|
|
BEGIN
|
70 |
|
|
IF I5 / I0 = 0 THEN
|
71 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 / I0' - 1" );
|
72 |
|
|
ELSE
|
73 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 / I0' - 2" );
|
74 |
|
|
END IF;
|
75 |
|
|
EXCEPTION
|
76 |
|
|
WHEN CONSTRAINT_ERROR =>
|
77 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 / I0'" );
|
78 |
|
|
WHEN OTHERS =>
|
79 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 / I0'" );
|
80 |
|
|
END;
|
81 |
|
|
|
82 |
|
|
BEGIN
|
83 |
|
|
IF N5 / I0 = 0 THEN
|
84 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 / I0' - 1" );
|
85 |
|
|
ELSE
|
86 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 / I0' - 2" );
|
87 |
|
|
END IF;
|
88 |
|
|
EXCEPTION
|
89 |
|
|
WHEN CONSTRAINT_ERROR =>
|
90 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'N5 / I0'" );
|
91 |
|
|
WHEN OTHERS =>
|
92 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'N5 / I0'" );
|
93 |
|
|
END;
|
94 |
|
|
|
95 |
|
|
BEGIN
|
96 |
|
|
IF I0 / I0 = 0 THEN
|
97 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 / I0' - 1" );
|
98 |
|
|
ELSE
|
99 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 / I0' - 2" );
|
100 |
|
|
END IF;
|
101 |
|
|
EXCEPTION
|
102 |
|
|
WHEN CONSTRAINT_ERROR =>
|
103 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I0 / I0'" );
|
104 |
|
|
WHEN OTHERS =>
|
105 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I0 / I0'" );
|
106 |
|
|
END;
|
107 |
|
|
|
108 |
|
|
BEGIN
|
109 |
|
|
IF I5 / I0 * I0 = 0 THEN
|
110 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 / I0 * I0' - 1" );
|
111 |
|
|
ELSE
|
112 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 / I0 * I0' - 2" );
|
113 |
|
|
END IF;
|
114 |
|
|
EXCEPTION
|
115 |
|
|
WHEN CONSTRAINT_ERROR =>
|
116 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 / I0 * I0'" );
|
117 |
|
|
WHEN OTHERS =>
|
118 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 / I0 * I0'" );
|
119 |
|
|
END;
|
120 |
|
|
|
121 |
|
|
BEGIN
|
122 |
|
|
IF I5 MOD I0 = 0 THEN
|
123 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 MOD I0' - 1" );
|
124 |
|
|
ELSE
|
125 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 MOD I0' - 2" );
|
126 |
|
|
END IF;
|
127 |
|
|
EXCEPTION
|
128 |
|
|
WHEN CONSTRAINT_ERROR =>
|
129 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 MOD I0'" );
|
130 |
|
|
WHEN OTHERS =>
|
131 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 MOD I0'" );
|
132 |
|
|
END;
|
133 |
|
|
|
134 |
|
|
BEGIN
|
135 |
|
|
IF N5 MOD I0 = 0 THEN
|
136 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 MOD I0' - 1" );
|
137 |
|
|
ELSE
|
138 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 MOD I0' - 2" );
|
139 |
|
|
END IF;
|
140 |
|
|
EXCEPTION
|
141 |
|
|
WHEN CONSTRAINT_ERROR =>
|
142 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'N5 MOD I0'" );
|
143 |
|
|
WHEN OTHERS =>
|
144 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'N5 MOD I0'" );
|
145 |
|
|
END;
|
146 |
|
|
|
147 |
|
|
BEGIN
|
148 |
|
|
IF I0 MOD I0 = 0 THEN
|
149 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 MOD I0' - 1" );
|
150 |
|
|
ELSE
|
151 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 MOD I0' - 2" );
|
152 |
|
|
END IF;
|
153 |
|
|
EXCEPTION
|
154 |
|
|
WHEN CONSTRAINT_ERROR =>
|
155 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I0 MOD I0'" );
|
156 |
|
|
WHEN OTHERS =>
|
157 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I0 MOD I0'" );
|
158 |
|
|
END;
|
159 |
|
|
|
160 |
|
|
BEGIN
|
161 |
|
|
IF I5 MOD I0 = (I5 + I0) MOD I0 THEN
|
162 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 MOD I0 = " &
|
163 |
|
|
"(I5 + I0) MOD I0' - 1" );
|
164 |
|
|
ELSE
|
165 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 MOD I0 = " &
|
166 |
|
|
"(I5 + I0) MOD I0' - 2" );
|
167 |
|
|
END IF;
|
168 |
|
|
EXCEPTION
|
169 |
|
|
WHEN CONSTRAINT_ERROR =>
|
170 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 MOD I0 = " &
|
171 |
|
|
"(I5 + I0) MOD I0'" );
|
172 |
|
|
WHEN OTHERS =>
|
173 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 MOD I0 = " &
|
174 |
|
|
"(I5 + I0) MOD I0'" );
|
175 |
|
|
END;
|
176 |
|
|
|
177 |
|
|
BEGIN
|
178 |
|
|
IF I5 REM I0 = 0 THEN
|
179 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 REM I0' - 1" );
|
180 |
|
|
ELSE
|
181 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 REM I0' - 2" );
|
182 |
|
|
END IF;
|
183 |
|
|
EXCEPTION
|
184 |
|
|
WHEN CONSTRAINT_ERROR =>
|
185 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 REM I0'" );
|
186 |
|
|
WHEN OTHERS =>
|
187 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 REM I0'" );
|
188 |
|
|
END;
|
189 |
|
|
|
190 |
|
|
BEGIN
|
191 |
|
|
IF N5 REM I0 = 0 THEN
|
192 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 REM I0' - 1" );
|
193 |
|
|
ELSE
|
194 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'N5 REM I0' - 2" );
|
195 |
|
|
END IF;
|
196 |
|
|
EXCEPTION
|
197 |
|
|
WHEN CONSTRAINT_ERROR =>
|
198 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'N5 REM I0'" );
|
199 |
|
|
WHEN OTHERS =>
|
200 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'N5 REM I0'" );
|
201 |
|
|
END;
|
202 |
|
|
|
203 |
|
|
BEGIN
|
204 |
|
|
IF I0 REM I0 = 0 THEN
|
205 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 REM I0' - 1" );
|
206 |
|
|
ELSE
|
207 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I0 REM I0' - 2" );
|
208 |
|
|
END IF;
|
209 |
|
|
EXCEPTION
|
210 |
|
|
WHEN CONSTRAINT_ERROR =>
|
211 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I0 REM I0'" );
|
212 |
|
|
WHEN OTHERS =>
|
213 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I0 REM I0'" );
|
214 |
|
|
END;
|
215 |
|
|
|
216 |
|
|
BEGIN
|
217 |
|
|
IF I5 REM (-I0) = I5 REM I0 THEN
|
218 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 REM (-I0) = " &
|
219 |
|
|
"I5 REM I0' - 1" );
|
220 |
|
|
ELSE
|
221 |
|
|
FAILED ( "NO EXCEPTION RAISED BY 'I5 REM (-I0) = " &
|
222 |
|
|
"I5 REM I0' - 2" );
|
223 |
|
|
END IF;
|
224 |
|
|
EXCEPTION
|
225 |
|
|
WHEN CONSTRAINT_ERROR =>
|
226 |
|
|
COMMENT ( "CONSTRAINT_ERROR RAISED BY 'I5 REM (-I0) " &
|
227 |
|
|
"= I5 REM I0'" );
|
228 |
|
|
WHEN OTHERS =>
|
229 |
|
|
FAILED ( "WRONG EXCEPTION RAISED BY 'I5 REM (-I0) = " &
|
230 |
|
|
"I5 REM I0'" );
|
231 |
|
|
END;
|
232 |
|
|
|
233 |
|
|
RESULT;
|
234 |
|
|
END C45504E;
|