1-- C49022A.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 NAMED NUMBER DECLARATIONS (INTEGER) MAY USE EXPRESSIONS
26-- WITH INTEGERS.
27
28-- BAW 29 SEPT 80
29-- TBN 10/28/85     RENAMED FROM C4A001A.ADA. ADDED RELATIONAL
30--                  OPERATORS AND USE OF NAMED NUMBERS.
31
32WITH REPORT;
33PROCEDURE C49022A IS
34
35     USE REPORT;
36
37     ADD1 : CONSTANT :=   1   +  1;
38     ADD2 : CONSTANT :=   1   + (-1);
39     ADD3 : CONSTANT := (-1)  +   1;
40     ADD4 : CONSTANT := (-1)  + (-1);
41     SUB1 : CONSTANT :=   1   -   1;
42     SUB2 : CONSTANT :=   1   - (-1);
43     SUB3 : CONSTANT := (-1)  -   1;
44     SUB4 : CONSTANT := (-1)  - (-1);
45     MUL1 : CONSTANT :=   1   *   1;
46     MUL2 : CONSTANT :=   1   * (-1);
47     MUL3 : CONSTANT := (-1)  *   1;
48     MUL4 : CONSTANT := (-1)  * (-1);
49     DIV1 : CONSTANT :=   1   /   1;
50     DIV2 : CONSTANT :=   1   / (-1);
51     DIV3 : CONSTANT := (-1)  /   1;
52     DIV4 : CONSTANT := (-1)  / (-1);
53     REM1 : CONSTANT :=  14  REM  5;
54     REM2 : CONSTANT :=  14  REM(-5);
55     REM3 : CONSTANT :=(-14) REM  5;
56     REM4 : CONSTANT :=(-14) REM(-5);
57     MOD1 : CONSTANT :=   4  MOD   3;
58     MOD2 : CONSTANT :=   4  MOD (-3);
59     MOD3 : CONSTANT := (-4) MOD   3;
60     MOD4 : CONSTANT := (-4) MOD (-3);
61     EXP1 : CONSTANT :=   1  ** 1;
62     EXP2 : CONSTANT := (-1) ** 1;
63     ABS1 : CONSTANT := ABS( - 10 );
64     ABS2 : CONSTANT := ABS( + 10 );
65     TOT1 : CONSTANT := ADD1 + SUB1 - MUL1 + DIV1 - REM3 + MOD2 - EXP1;
66     LES1 : CONSTANT := BOOLEAN'POS (1 < 2);
67     LES2 : CONSTANT := BOOLEAN'POS (1 < (-2));
68     LES3 : CONSTANT := BOOLEAN'POS ((-1) < (-2));
69     LES4 : CONSTANT := BOOLEAN'POS (ADD1 < SUB1);
70     GRE1 : CONSTANT := BOOLEAN'POS (2 > 1);
71     GRE2 : CONSTANT := BOOLEAN'POS ((-1) > 2);
72     GRE3 : CONSTANT := BOOLEAN'POS ((-1) > (-2));
73     GRE4 : CONSTANT := BOOLEAN'POS (ADD1 > SUB1);
74     LEQ1 : CONSTANT := BOOLEAN'POS (1 <= 1);
75     LEQ2 : CONSTANT := BOOLEAN'POS ((-1) <= 1);
76     LEQ3 : CONSTANT := BOOLEAN'POS ((-1) <= (-2));
77     LEQ4 : CONSTANT := BOOLEAN'POS (ADD2 <= SUB3);
78     GEQ1 : CONSTANT := BOOLEAN'POS (2 >= 1);
79     GEQ2 : CONSTANT := BOOLEAN'POS ((-2) >= 1);
80     GEQ3 : CONSTANT := BOOLEAN'POS ((-2) >= (-1));
81     GEQ4 : CONSTANT := BOOLEAN'POS (ADD2 >= SUB3);
82     EQU1 : CONSTANT := BOOLEAN'POS (2 = 2);
83     EQU2 : CONSTANT := BOOLEAN'POS ((-2) = 2);
84     EQU3 : CONSTANT := BOOLEAN'POS ((-2) = (-2));
85     EQU4 : CONSTANT := BOOLEAN'POS (ADD2 = SUB3);
86     NEQ1 : CONSTANT := BOOLEAN'POS (2 /= 2);
87     NEQ2 : CONSTANT := BOOLEAN'POS ((-2) /= 1);
88     NEQ3 : CONSTANT := BOOLEAN'POS ((-2) /= (-2));
89     NEQ4 : CONSTANT := BOOLEAN'POS (ADD2 /= SUB3);
90
91
92BEGIN
93     TEST("C49022A","CHECK THAT NAMED NUMBER DECLARATIONS (INTEGER) " &
94                    "MAY USE EXPRESSIONS WITH INTEGERS");
95
96     IF ADD1 /= 2 OR ADD2 /= 0 OR ADD3 /= 0 OR ADD4 /= -2 THEN
97          FAILED("ERROR IN THE ADDING OPERATOR +");
98     END IF;
99
100     IF SUB1 /= 0 OR SUB2 /= 2 OR SUB3 /= -2 OR SUB4 /= 0 THEN
101          FAILED("ERROR IN THE ADDING OPERATOR -");
102     END IF;
103
104     IF MUL1 /= 1 OR MUL2 /= -1 OR MUL3 /= -1 OR MUL4 /= 1 THEN
105          FAILED("ERROR IN THE MULTIPLYING OPERATOR *");
106     END IF;
107
108     IF DIV1 /= 1 OR DIV2 /= -1 OR DIV3 /= -1 OR DIV4 /= 1 THEN
109          FAILED("ERROR IN THE MULTIPLYING OPERATOR /");
110     END IF;
111
112     IF REM1 /= 4 OR REM2 /=  4 OR REM3 /= -4 OR REM4 /= -4 THEN
113          FAILED("ERROR IN THE MULTIPLYING OPERATOR REM");
114     END IF;
115
116     IF MOD1 /= 1 OR MOD2 /= -2 OR MOD3 /= 2 OR MOD4 /= -1 THEN
117          FAILED("ERROR IN THE MULTIPLYING OPERATOR MOD");
118     END IF;
119
120     IF EXP1 /= 1 OR EXP2 /= -1 THEN
121          FAILED("ERROR IN THE EXPONENTIATING OPERATOR");
122     END IF;
123
124     IF ABS1 /= 10 OR ABS2 /= 10 THEN
125          FAILED("ERROR IN THE ABS OPERATOR");
126     END IF;
127
128     IF TOT1 /= 3 THEN
129          FAILED("ERROR IN USING NAMED NUMBERS WITH OPERATORS");
130     END IF;
131
132     IF LES1 /= 1 OR LES2 /= 0 OR LES3 /= 0 OR LES4 /= 0 THEN
133          FAILED("ERROR IN THE LESS THAN OPERATOR");
134     END IF;
135
136     IF GRE1 /= 1 OR GRE2 /= 0 OR GRE3 /= 1 OR GRE4 /= 1 THEN
137          FAILED("ERROR IN THE GREATER THAN OPERATOR");
138     END IF;
139
140     IF LEQ1 /= 1 OR LEQ2 /= 1 OR LEQ3 /= 0 OR LEQ4 /= 0 THEN
141          FAILED("ERROR IN THE LESS THAN EQUAL OPERATOR");
142     END IF;
143
144     IF GEQ1 /= 1 OR GEQ2 /= 0 OR GEQ3 /= 0 OR GEQ4 /= 1 THEN
145          FAILED("ERROR IN THE GREATER THAN EQUAL OPERATOR");
146     END IF;
147
148     IF EQU1 /= 1 OR EQU2 /= 0 OR EQU3 /= 1 OR EQU4 /= 0 THEN
149          FAILED("ERROR IN THE EQUAL OPERATOR");
150     END IF;
151
152     IF NEQ1 /= 0 OR NEQ2 /= 1 OR NEQ3 /= 0 OR NEQ4 /= 1 THEN
153          FAILED("ERROR IN THE NOT EQUAL OPERATOR");
154     END IF;
155
156     RESULT;
157
158END C49022A;
159