1-- C46031A.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-- OBJECTIVE:
26--     CHECK CONVERSIONS TO FIXED POINT TYPES WHEN THE OPERAND TYPE
27--     IS AN INTEGER TYPE.
28
29-- HISTORY:
30--     JET 07/11/88  CREATED ORIGINAL TEST.
31
32WITH REPORT; USE REPORT;
33PROCEDURE C46031A IS
34
35     TYPE FIX1 IS DELTA 2#0.01# RANGE -16#20.0# .. 16#20.0#;
36     TYPE FIX2 IS DELTA 2#0.0001# RANGE -16#80.0# .. 16#80.0#;
37     TYPE FIX3 IS DELTA 2#0.000001# RANGE -16#200.0# .. 16#200.0#;
38
39     TYPE NEW_INT IS NEW INTEGER RANGE -16#200# .. 16#200#;
40
41     I : INTEGER;
42     J : NEW_INT;
43
44     FUNCTION IDENT_NEW (X : NEW_INT) RETURN NEW_INT IS
45     BEGIN
46          RETURN X * NEW_INT(IDENT_INT(1));
47     END IDENT_NEW;
48
49BEGIN
50     TEST ("C46031A", "CHECK CONVERSIONS TO FIXED POINT TYPES WHEN " &
51                      "THE OPERAND TYPE IS AN INTEGER TYPE");
52
53     I := IDENT_INT(-16#1F#);
54     IF FIX1(I) /= -16#1F.0# THEN
55          FAILED ("INCORRECT RESULT FROM CONVERSION (1)");
56     END IF;
57
58     J := IDENT_NEW(0);
59     IF FIX1(J) /= 0.0 THEN
60          FAILED ("INCORRECT RESULT FROM CONVERSION (2)");
61     END IF;
62
63     I := IDENT_INT(16#7F#);
64     IF FIX2(I) /= 16#7F.0# THEN
65          FAILED ("INCORRECT RESULT FROM CONVERSION (3)");
66     END IF;
67
68     J := IDENT_NEW(16#1#);
69     IF FIX2(J) /= 16#1.0# THEN
70          FAILED ("INCORRECT RESULT FROM CONVERSION (4)");
71     END IF;
72
73     I := IDENT_INT(-16#55#);
74     IF FIX3(I) /= -16#55.0# THEN
75          FAILED ("INCORRECT RESULT FROM CONVERSION (5)");
76     END IF;
77
78     J := IDENT_NEW(-16#1#);
79     IF FIX3(J) /= -16#1.0# THEN
80          FAILED ("INCORRECT RESULT FROM CONVERSION (6)");
81     END IF;
82
83     RESULT;
84
85END C46031A;
86