1-- C45220D.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  '<' , '<=' , '>' , '>='  PRODUCE CORRECT RESULTS ON
26--    OPERANDS OF A TYPE DERIVED FROM THE TYPE 'BOOLEAN'
27--    (IN PARTICULAR, FOR OPERANDS HAVING DIFFERENT SUBTYPES).
28
29-- THIS TEST IS DERIVED FROM  C45220B.ADA , C45220C.ADA .
30
31
32-- RM    28 OCTOBER 1980
33-- JWC 7/8/85   RENAMED TO -AB
34
35WITH  REPORT ;
36PROCEDURE  C45220D  IS
37
38
39     USE REPORT;
40
41     TYPE  NB  IS  NEW BOOLEAN ;
42
43     SUBTYPE  T1  IS  NB RANGE NB'(FALSE)..NB'(FALSE) ;
44     SUBTYPE  T2  IS  NB RANGE NB'(TRUE )..NB'(TRUE );
45     SUBTYPE  T3  IS  NB RANGE NB'(FALSE)..NB'(TRUE );
46     SUBTYPE  T4  IS  T3 RANGE NB'(TRUE )..NB'(TRUE );
47
48     FVAR1   : T1 := NB'(FALSE) ;
49     TVAR1   : T2 := NB'(TRUE );
50     FVAR2   : T3 := NB'(FALSE) ;
51     TVAR2   : T4 := NB'(TRUE );
52
53     ERROR_COUNT : INTEGER := 0 ;
54
55     PROCEDURE  BUMP  IS
56     BEGIN
57          ERROR_COUNT := ERROR_COUNT + 1 ;
58     END BUMP ;
59
60     FUNCTION  IDENT_NEW_BOOL( THE_ARGUMENT : NB )  RETURN  NB  IS
61     BEGIN
62          IF  EQUAL(2,2)  THEN  RETURN THE_ARGUMENT;
63          ELSE  RETURN  NB'(FALSE) ;
64          END IF;
65     END ;
66
67
68BEGIN
69
70
71     TEST( "C45220D" , "CHECK THAT  '<' , '<=' , '>' , '>='  PRODUCE" &
72                       " CORRECT RESULTS ON DERIVED-BOOLEAN-TYPE" &
73                       " OPERANDS" ) ;
74
75     -- 64  CASES ( 2 * 2  ORDERED PAIRS OF OPERAND VALUES,
76     --               4    OPERATORS : '<' , <=' , '>' , '>='
77     --               4    VARIABLE/LITERAL FOR LEFT OPERAND,
78     --                    VARIABLE/LITERAL FOR RIGHT OPERAND.
79
80
81     --  'BUMP'  MEANS  'BUMP THE ERROR COUNT'
82
83     FVAR1   := IDENT_NEW_BOOL( NB'(FALSE) ) ;
84     TVAR1   := IDENT_NEW_BOOL( NB'(TRUE )) ;
85     FVAR2   := IDENT_NEW_BOOL( NB'(FALSE) ) ;
86     TVAR2   := IDENT_NEW_BOOL( NB'(TRUE )) ;
87
88
89     ERROR_COUNT := 0 ;
90
91     IF  NB'(FALSE) <  NB'(FALSE)  THEN  BUMP ;                END IF;
92     IF      FVAR1  <  NB'(FALSE)  THEN  BUMP ;                END IF;
93     IF  NB'(FALSE) <      FVAR2   THEN  BUMP ;                END IF;
94     IF      FVAR2  <      FVAR1   THEN  BUMP ;                END IF;
95
96     IF  NB'(FALSE) <  NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
97     IF      FVAR1  <  NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
98     IF  NB'(FALSE) <      TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
99     IF      FVAR2  <      TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
100
101     IF  NB'(TRUE ) <  NB'(FALSE)  THEN  BUMP ;                END IF;
102     IF  NB'(TRUE ) <      FVAR1   THEN  BUMP ;                END IF;
103     IF      TVAR2  <  NB'(FALSE)  THEN  BUMP ;                END IF;
104     IF      TVAR1  <      FVAR2   THEN  BUMP ;                END IF;
105
106     IF  NB'(TRUE ) <  NB'(TRUE )  THEN  BUMP ;                END IF;
107     IF      TVAR1  <  NB'(TRUE )  THEN  BUMP ;                END IF;
108     IF  NB'(TRUE ) <      TVAR2   THEN  BUMP ;                END IF;
109     IF      TVAR2  <      TVAR1   THEN  BUMP ;                END IF;
110
111     IF  ERROR_COUNT > 0  THEN
112          FAILED( "ORDERING OF N_BOOLEAN VALUES - FAILURE '<'" );
113     END IF;
114
115
116     ERROR_COUNT := 0 ;
117
118     IF  NB'(FALSE) <= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
119     IF      FVAR1  <= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
120     IF  NB'(FALSE) <=     FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
121     IF      FVAR2  <=     FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
122
123     IF  NB'(FALSE) <= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
124     IF      FVAR1  <= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
125     IF  NB'(FALSE) <=     TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
126     IF      FVAR2  <=     TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
127
128     IF  NB'(TRUE ) <= NB'(FALSE)  THEN  BUMP ;                END IF;
129     IF  NB'(TRUE ) <=     FVAR1   THEN  BUMP ;                END IF;
130     IF      TVAR2  <= NB'(FALSE)  THEN  BUMP ;                END IF;
131     IF      TVAR1  <=     FVAR2   THEN  BUMP ;                END IF;
132
133     IF  NB'(TRUE ) <= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
134     IF      TVAR1  <= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
135     IF  NB'(TRUE ) <=     TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
136     IF      TVAR2  <=     TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
137
138     IF  ERROR_COUNT > 0  THEN
139          FAILED( "ORDERING OF N_BOOLEAN VALUES - FAILURE '<='" );
140     END IF;
141
142
143     ERROR_COUNT := 0 ;
144
145     IF  NB'(FALSE) >  NB'(FALSE)  THEN  BUMP ;                END IF;
146     IF      FVAR1  >  NB'(FALSE)  THEN  BUMP ;                END IF;
147     IF  NB'(FALSE) >      FVAR2   THEN  BUMP ;                END IF;
148     IF      FVAR2  >      FVAR1   THEN  BUMP ;                END IF;
149
150     IF  NB'(FALSE) >  NB'(TRUE )  THEN  BUMP ;                END IF;
151     IF      FVAR1  >  NB'(TRUE )  THEN  BUMP ;                END IF;
152     IF  NB'(FALSE) >      TVAR2   THEN  BUMP ;                END IF;
153     IF      FVAR2  >      TVAR1   THEN  BUMP ;                END IF;
154
155     IF  NB'(TRUE ) >  NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
156     IF  NB'(TRUE ) >      FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
157     IF      TVAR2  >  NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
158     IF      TVAR1  >      FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
159
160     IF  NB'(TRUE ) >  NB'(TRUE )  THEN  BUMP ;                END IF;
161     IF      TVAR1  >  NB'(TRUE )  THEN  BUMP ;                END IF;
162     IF  NB'(TRUE ) >      TVAR2   THEN  BUMP ;                END IF;
163     IF      TVAR2  >      TVAR1   THEN  BUMP ;                END IF;
164
165     IF  ERROR_COUNT > 0  THEN
166          FAILED( "ORDERING OF N_BOOLEAN VALUES - FAILURE '>'" );
167     END IF;
168
169
170     ERROR_COUNT := 0 ;
171
172     IF  NB'(FALSE) >= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
173     IF      FVAR1  >= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
174     IF  NB'(FALSE) >=     FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
175     IF      FVAR2  >=     FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
176
177     IF  NB'(FALSE) >= NB'(TRUE )  THEN  BUMP ;                END IF;
178     IF      FVAR1  >= NB'(TRUE )  THEN  BUMP ;                END IF;
179     IF  NB'(FALSE) >=     TVAR2   THEN  BUMP ;                END IF;
180     IF      FVAR2  >=     TVAR1   THEN  BUMP ;                END IF;
181
182     IF  NB'(TRUE ) >= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
183     IF  NB'(TRUE ) >=     FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
184     IF      TVAR2  >= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
185     IF      TVAR1  >=     FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
186
187     IF  NB'(TRUE ) >= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
188     IF      TVAR1  >= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
189     IF  NB'(TRUE ) >=     TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
190     IF      TVAR2  >=     TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
191
192     IF  ERROR_COUNT > 0  THEN
193          FAILED( "ORDERING OF N_BOOLEAN VALUES - FAILURE '>='" );
194     END IF;
195
196
197     RESULT ;
198
199
200END C45220D;
201