1-- C47002B.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 VALUES BELONGING TO EACH CLASS OF TYPE CAN BE WRITTEN AS
26-- THE OPERANDS OF QUALIFIED EXPRESSIONS.
27-- THIS TEST IS FOR REAL TYPES.
28
29-- RJW 7/23/86
30
31WITH REPORT; USE REPORT;
32PROCEDURE C47002B IS
33
34BEGIN
35
36     TEST( "C47002B", "CHECK THAT VALUES HAVING REAL TYPES " &
37                      "CAN BE WRITTEN AS THE OPERANDS OF " &
38                      "QUALIFIED EXPRESSIONS" );
39
40     DECLARE -- FLOATING POINT TYPES.
41
42          TYPE RESULTS IS (FL1, FL2, FL3);
43
44          TYPE FLT IS DIGITS 3 RANGE -5.0 .. 5.0;
45
46          TYPE NFLT IS NEW FLOAT;
47
48          FUNCTION F (FL : FLT) RETURN RESULTS IS
49          BEGIN
50               RETURN FL1;
51          END F;
52
53          FUNCTION F (FL : NFLT) RETURN RESULTS IS
54          BEGIN
55               RETURN FL2;
56          END F;
57
58          FUNCTION F (FL : FLOAT) RETURN RESULTS IS
59          BEGIN
60               RETURN FL3;
61          END F;
62
63     BEGIN
64          IF F (FLT'(0.0)) /= FL1 THEN
65               FAILED ( "INCORRECT RESULTS FOR TYPE FLT" );
66          END IF;
67
68          IF F (NFLT'(0.0)) /= FL2 THEN
69               FAILED ( "INCORRECT RESULTS FOR TYPE NFLT" );
70          END IF;
71
72          IF F (FLOAT'(0.0)) /= FL3 THEN
73               FAILED ( "INCORRECT RESULTS FOR TYPE FLOAT" );
74          END IF;
75     END;
76
77     DECLARE -- FIXED POINT TYPES.
78
79          TYPE RESULTS IS (FI1, FI2, FI3);
80
81          TYPE FIXED IS DELTA 0.5 RANGE -5.0 .. 5.0;
82
83          TYPE NFIX IS NEW FIXED;
84
85          FUNCTION F (FI : FIXED) RETURN RESULTS IS
86          BEGIN
87               RETURN FI1;
88          END F;
89
90          FUNCTION F (FI : NFIX) RETURN RESULTS IS
91          BEGIN
92               RETURN FI2;
93          END F;
94
95          FUNCTION F (FI : DURATION) RETURN RESULTS IS
96          BEGIN
97               RETURN FI3;
98          END F;
99
100     BEGIN
101          IF F (FIXED'(0.0)) /= FI1 THEN
102               FAILED ( "INCORRECT RESULTS FOR TYPE FIXED" );
103          END IF;
104
105          IF F (NFIX'(0.0)) /= FI2 THEN
106               FAILED ( "INCORRECT RESULTS FOR TYPE NFIX" );
107          END IF;
108
109          IF F (DURATION'(0.0)) /= FI3 THEN
110               FAILED ( "INCORRECT RESULTS FOR TYPE DURATION" );
111          END IF;
112     END;
113
114     RESULT;
115END C47002B;
116