1-- C46033A.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 ANOTHER FIXED POINT TYPE.
28
29-- HISTORY:
30--     JET 07/12/88  CREATED ORIGINAL TEST.
31
32WITH REPORT; USE REPORT;
33PROCEDURE C46033A 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     F1 : FIX1;
40     F2 : FIX2;
41     F3 : FIX3;
42
43     GENERIC
44          TYPE F IS DELTA <>;
45     FUNCTION IDENT_G (X : F) RETURN F;
46
47     FUNCTION IDENT_G (X : F) RETURN F IS
48     BEGIN
49          RETURN X + F(IDENT_INT(0));
50     END IDENT_G;
51
52     FUNCTION IDENT IS NEW IDENT_G(FIX1);
53     FUNCTION IDENT IS NEW IDENT_G(FIX2);
54     FUNCTION IDENT IS NEW IDENT_G(FIX3);
55
56BEGIN
57     TEST ("C46033A", "CHECK CONVERSIONS TO FIXED POINT TYPES WHEN " &
58                      "THE OPERAND TYPE IS ANOTHER FIXED POINT TYPE");
59
60     F1 := IDENT(-16#1F.C#);
61     IF FIX1(F1) /= -16#1F.C# THEN
62          FAILED ("INCORRECT RESULT FROM CONVERSION (1)");
63     END IF;
64
65     F1 := IDENT(16#0.4#);
66     IF FIX2(F1) /= 16#0.4# THEN
67          FAILED ("INCORRECT RESULT FROM CONVERSION (2)");
68     END IF;
69
70     F1 := IDENT(-16#10.4#);
71     IF FIX3(F1) /= -16#10.4# THEN
72          FAILED ("INCORRECT RESULT FROM CONVERSION (3)");
73     END IF;
74
75     F2 := IDENT(16#3.3#);
76     IF FIX1(F2) < 16#3.0# OR
77        FIX1(F2) > 16#3.4# THEN
78          FAILED ("INCORRECT RESULT FROM CONVERSION (4)");
79     END IF;
80
81     F2 := IDENT(-16#40.1#);
82     IF FIX2(F2) /= -16#40.1# THEN
83          FAILED ("INCORRECT RESULT FROM CONVERSION (5)");
84     END IF;
85
86     F2 := IDENT(16#0.0#);
87     IF FIX3(F2) /= 16#0.0# THEN
88          FAILED ("INCORRECT RESULT FROM CONVERSION (6)");
89     END IF;
90
91     F3 := IDENT(-16#0.04#);
92     IF FIX1(F3) < -16#0.4# OR
93        FIX1(F3) > -16#0.0# THEN
94          FAILED ("INCORRECT RESULT FROM CONVERSION (7)");
95     END IF;
96
97     F3 := -IDENT(16#55.A8#);
98     IF FIX2(F3) < -16#55.B# OR
99        FIX2(F3) > -16#55.A# THEN
100          FAILED ("INCORRECT RESULT FROM CONVERSION (8)");
101     END IF;
102
103     F3 := IDENT(16#101.84#);
104     IF FIX3(F3) /= 16#101.84# THEN
105          FAILED ("INCORRECT RESULT FROM CONVERSION (9)");
106     END IF;
107
108     RESULT;
109
110END C46033A;
111