1 |
294 |
jeremybenn |
-- C45431A.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 FOR FIXED POINT TYPES +A = A AND THAT, FOR MODEL NUMBERS,
|
26 |
|
|
-- -(-A) = A.
|
27 |
|
|
|
28 |
|
|
-- CASE A: BASIC TYPES THAT FIT THE CHARACTERISTICS OF DURATION'BASE.
|
29 |
|
|
|
30 |
|
|
-- WRG 8/28/86
|
31 |
|
|
-- PWN 02/02/95 REMOVED INCONSISTENCIES WITH ADA 9X.
|
32 |
|
|
|
33 |
|
|
WITH REPORT; USE REPORT;
|
34 |
|
|
PROCEDURE C45431A IS
|
35 |
|
|
|
36 |
|
|
BEGIN
|
37 |
|
|
|
38 |
|
|
TEST ("C45431A", "CHECK THAT FOR FIXED POINT TYPES +A = A AND " &
|
39 |
|
|
"THAT, FOR MODEL NUMBERS, -(-A) = A " &
|
40 |
|
|
"-- BASIC TYPES");
|
41 |
|
|
|
42 |
|
|
-------------------------------------------------------------------
|
43 |
|
|
|
44 |
|
|
A: DECLARE
|
45 |
|
|
TYPE LIKE_DURATION IS DELTA 0.020 RANGE -86_400.0 .. 86_400.0;
|
46 |
|
|
|
47 |
|
|
NON_MODEL_CONST : CONSTANT := 2.0 / 3;
|
48 |
|
|
NON_MODEL_VAR : LIKE_DURATION := 0.0;
|
49 |
|
|
|
50 |
|
|
SMALL, MAX, MIN, ZERO : LIKE_DURATION := 0.5;
|
51 |
|
|
X : LIKE_DURATION := 0.0;
|
52 |
|
|
BEGIN
|
53 |
|
|
-- INITIALIZE "CONSTANTS":
|
54 |
|
|
IF EQUAL (3, 3) THEN
|
55 |
|
|
NON_MODEL_VAR := NON_MODEL_CONST;
|
56 |
|
|
SMALL := LIKE_DURATION'SMALL;
|
57 |
|
|
MAX := LIKE_DURATION'LAST;
|
58 |
|
|
MIN := LIKE_DURATION'FIRST;
|
59 |
|
|
ZERO := 0.0;
|
60 |
|
|
END IF;
|
61 |
|
|
|
62 |
|
|
-- CHECK + OR - ZERO = ZERO:
|
63 |
|
|
IF "+"(RIGHT => ZERO) /= 0.0 OR
|
64 |
|
|
+LIKE_DURATION'(0.0) /= ZERO THEN
|
65 |
|
|
FAILED ("+0.0 /= 0.0");
|
66 |
|
|
END IF;
|
67 |
|
|
IF "-"(RIGHT => ZERO) /= 0.0 OR
|
68 |
|
|
-LIKE_DURATION'(0.0) /= ZERO THEN
|
69 |
|
|
FAILED ("-0.0 /= 0.0");
|
70 |
|
|
END IF;
|
71 |
|
|
IF -(-ZERO) /= 0.0 THEN
|
72 |
|
|
FAILED ("-(-0.0) /= 0.0");
|
73 |
|
|
END IF;
|
74 |
|
|
|
75 |
|
|
-- CHECK + AND - MAX:
|
76 |
|
|
IF EQUAL (3, 3) THEN
|
77 |
|
|
X := MAX;
|
78 |
|
|
END IF;
|
79 |
|
|
IF +X /= MAX OR +LIKE_DURATION'LAST /= MAX THEN
|
80 |
|
|
FAILED ("+LIKE_DURATION'LAST /= LIKE_DURATION'LAST");
|
81 |
|
|
END IF;
|
82 |
|
|
IF -(-X) /= MAX OR -(-LIKE_DURATION'LAST) /= MAX THEN
|
83 |
|
|
FAILED ("-(-LIKE_DURATION'LAST) /= LIKE_DURATION'LAST");
|
84 |
|
|
END IF;
|
85 |
|
|
|
86 |
|
|
-- CHECK + AND - MIN:
|
87 |
|
|
IF EQUAL (3, 3) THEN
|
88 |
|
|
X := MIN;
|
89 |
|
|
END IF;
|
90 |
|
|
IF +X /= MIN OR +LIKE_DURATION'FIRST /= MIN THEN
|
91 |
|
|
FAILED ("+LIKE_DURATION'FIRST /= LIKE_DURATION'FIRST");
|
92 |
|
|
END IF;
|
93 |
|
|
IF -(-X) /= MIN OR -(-LIKE_DURATION'FIRST) /= MIN THEN
|
94 |
|
|
FAILED("-(-LIKE_DURATION'FIRST) /= LIKE_DURATION'FIRST");
|
95 |
|
|
END IF;
|
96 |
|
|
|
97 |
|
|
-- CHECK + AND - SMALL:
|
98 |
|
|
IF EQUAL (3, 3) THEN
|
99 |
|
|
X := SMALL;
|
100 |
|
|
END IF;
|
101 |
|
|
IF +X /= SMALL OR +LIKE_DURATION'SMALL /= SMALL THEN
|
102 |
|
|
FAILED ("+LIKE_DURATION'SMALL /= LIKE_DURATION'SMALL");
|
103 |
|
|
END IF;
|
104 |
|
|
IF -(-X) /= SMALL OR -(-LIKE_DURATION'SMALL) /= SMALL THEN
|
105 |
|
|
FAILED("-(-LIKE_DURATION'SMALL) /= LIKE_DURATION'SMALL");
|
106 |
|
|
END IF;
|
107 |
|
|
|
108 |
|
|
-- CHECK ARBITRARY MID-RANGE NUMBERS:
|
109 |
|
|
IF EQUAL (3, 3) THEN
|
110 |
|
|
X := 1000.984_375;
|
111 |
|
|
END IF;
|
112 |
|
|
IF +X /= 1000.984_375 OR +1000.984_375 /= X THEN
|
113 |
|
|
FAILED ("+1000.984_375 /= 1000.984_375");
|
114 |
|
|
END IF;
|
115 |
|
|
IF -(-X) /= 1000.984_375 OR -(-1000.984_375) /= X THEN
|
116 |
|
|
FAILED ("-(-1000.984_375) /= 1000.984_375");
|
117 |
|
|
END IF;
|
118 |
|
|
|
119 |
|
|
-- CHECK "+" AND "-" FOR NON-MODEL NUMBER:
|
120 |
|
|
IF +LIKE_DURATION'(NON_MODEL_CONST) NOT IN 0.656_25 ..
|
121 |
|
|
0.671_875 OR
|
122 |
|
|
+NON_MODEL_VAR NOT IN 0.656_25 .. 0.671_875 THEN
|
123 |
|
|
FAILED ("+LIKE_DURATION'(2.0 / 3) NOT IN 0.656_25 .. " &
|
124 |
|
|
"0.671_875");
|
125 |
|
|
END IF;
|
126 |
|
|
IF -LIKE_DURATION'(NON_MODEL_CONST) NOT IN -0.671_875 ..
|
127 |
|
|
-0.656_25 OR
|
128 |
|
|
-NON_MODEL_VAR NOT IN -0.671_875 .. -0.656_25 THEN
|
129 |
|
|
FAILED ("-LIKE_DURATION'(2.0 / 3) NOT IN -0.671_875 " &
|
130 |
|
|
".. -0.656_25");
|
131 |
|
|
END IF;
|
132 |
|
|
|
133 |
|
|
EXCEPTION
|
134 |
|
|
WHEN OTHERS =>
|
135 |
|
|
FAILED ("EXCEPTION RAISED -- A");
|
136 |
|
|
END A;
|
137 |
|
|
|
138 |
|
|
-------------------------------------------------------------------
|
139 |
|
|
|
140 |
|
|
B: DECLARE
|
141 |
|
|
TYPE DECIMAL_M4 IS DELTA 100.0 RANGE -1000.0 .. 1000.0;
|
142 |
|
|
|
143 |
|
|
NON_MODEL_CONST : CONSTANT := 2.0 / 3;
|
144 |
|
|
NON_MODEL_VAR : DECIMAL_M4 := 0.0;
|
145 |
|
|
|
146 |
|
|
SMALL, MAX, MIN, ZERO : DECIMAL_M4 := -128.0;
|
147 |
|
|
X : DECIMAL_M4 := 0.0;
|
148 |
|
|
BEGIN
|
149 |
|
|
-- INITIALIZE "CONSTANTS":
|
150 |
|
|
IF EQUAL (3, 3) THEN
|
151 |
|
|
NON_MODEL_VAR := NON_MODEL_CONST;
|
152 |
|
|
SMALL := DECIMAL_M4'SMALL;
|
153 |
|
|
ZERO := 0.0;
|
154 |
|
|
END IF;
|
155 |
|
|
|
156 |
|
|
-- CHECK + OR - ZERO = ZERO:
|
157 |
|
|
IF +ZERO /= 0.0 OR +DECIMAL_M4'(0.0) /= ZERO THEN
|
158 |
|
|
FAILED ("+0.0 /= 0.0");
|
159 |
|
|
END IF;
|
160 |
|
|
IF -ZERO /= 0.0 OR -DECIMAL_M4'(0.0) /= ZERO THEN
|
161 |
|
|
FAILED ("-0.0 /= 0.0");
|
162 |
|
|
END IF;
|
163 |
|
|
IF -(-ZERO) /= 0.0 THEN
|
164 |
|
|
FAILED ("-(-0.0) /= 0.0");
|
165 |
|
|
END IF;
|
166 |
|
|
|
167 |
|
|
-- CHECK + AND - MAX:
|
168 |
|
|
IF EQUAL (3, 3) THEN
|
169 |
|
|
X := MAX;
|
170 |
|
|
END IF;
|
171 |
|
|
-- CHECK + AND - SMALL:
|
172 |
|
|
IF EQUAL (3, 3) THEN
|
173 |
|
|
X := SMALL;
|
174 |
|
|
END IF;
|
175 |
|
|
IF +X /= SMALL OR +DECIMAL_M4'SMALL /= SMALL THEN
|
176 |
|
|
FAILED ("+DECIMAL_M4'SMALL /= DECIMAL_M4'SMALL");
|
177 |
|
|
END IF;
|
178 |
|
|
IF -(-X) /= SMALL OR -(-DECIMAL_M4'SMALL) /= SMALL THEN
|
179 |
|
|
FAILED ("-(-DECIMAL_M4'SMALL) /= DECIMAL_M4'SMALL");
|
180 |
|
|
END IF;
|
181 |
|
|
|
182 |
|
|
-- CHECK ARBITRARY MID-RANGE NUMBERS:
|
183 |
|
|
IF EQUAL (3, 3) THEN
|
184 |
|
|
X := 256.0;
|
185 |
|
|
END IF;
|
186 |
|
|
IF +X /= 256.0 OR +256.0 /= X THEN
|
187 |
|
|
FAILED ("+256.0 /= 256.0");
|
188 |
|
|
END IF;
|
189 |
|
|
IF -(-X) /= 256.0 OR -(-256.0) /= X THEN
|
190 |
|
|
FAILED ("-(-256.0) /= 256.0");
|
191 |
|
|
END IF;
|
192 |
|
|
|
193 |
|
|
-- CHECK "+" AND "-" FOR NON-MODEL NUMBER:
|
194 |
|
|
IF +DECIMAL_M4'(NON_MODEL_CONST) NOT IN 0.0 .. 64.0 OR
|
195 |
|
|
+NON_MODEL_VAR NOT IN 0.0 .. 64.0 THEN
|
196 |
|
|
FAILED ("+DECIMAL_M4'(2.0 / 3) NOT IN 0.0 .. 64.0");
|
197 |
|
|
END IF;
|
198 |
|
|
IF -DECIMAL_M4'(NON_MODEL_CONST) NOT IN -64.0 .. 0.0 OR
|
199 |
|
|
-NON_MODEL_VAR NOT IN -64.0 .. 0.0 THEN
|
200 |
|
|
FAILED ("-DECIMAL_M4'(2.0 / 3) NOT IN -64.0 .. 0.0");
|
201 |
|
|
END IF;
|
202 |
|
|
|
203 |
|
|
EXCEPTION
|
204 |
|
|
WHEN OTHERS =>
|
205 |
|
|
FAILED ("EXCEPTION RAISED -- B");
|
206 |
|
|
END B;
|
207 |
|
|
|
208 |
|
|
-------------------------------------------------------------------
|
209 |
|
|
|
210 |
|
|
RESULT;
|
211 |
|
|
|
212 |
|
|
END C45431A;
|