1-- C45220C.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  '='  AND  '/='  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  C45220A.ADA .
30
31
32-- RM    27 OCTOBER 1980
33-- JWC 7/8/85   RENAMED TO -AB
34
35
36WITH  REPORT ;
37PROCEDURE  C45220C  IS
38
39
40     USE REPORT;
41
42     TYPE  NB  IS  NEW BOOLEAN ;
43
44     SUBTYPE  T1  IS  NB RANGE NB'(FALSE)..NB'(FALSE) ;
45     SUBTYPE  T2  IS  NB RANGE NB'(TRUE )..NB'(TRUE );
46     SUBTYPE  T3  IS  NB RANGE NB'(FALSE)..NB'(TRUE );
47     SUBTYPE  T4  IS  T3 RANGE NB'(TRUE )..NB'(TRUE );
48
49     FVAR1   : T1 := NB'(FALSE) ;
50     TVAR1   : T2 := NB'(TRUE );
51     FVAR2   : T3 := NB'(FALSE) ;
52     TVAR2   : T4 := NB'(TRUE );
53
54     ERROR_COUNT : INTEGER := 0 ;   -- INITIAL VALUE ESSENTIAL
55
56     PROCEDURE  BUMP  IS
57     BEGIN
58          ERROR_COUNT := ERROR_COUNT + 1 ;
59     END BUMP ;
60
61     FUNCTION  IDENT_NEW_BOOL( THE_ARGUMENT : NB )  RETURN  NB  IS
62     BEGIN
63          IF  EQUAL(2,2)  THEN  RETURN THE_ARGUMENT;
64          ELSE  RETURN  NB'(FALSE) ;
65          END IF;
66     END ;
67
68
69BEGIN
70
71
72     TEST( "C45220C" , "CHECK THAT  '='  AND  '/='  PRODUCE CORRECT" &
73                       " RESULTS ON DERIVED-BOOLEAN-TYPE OPERANDS" ) ;
74
75     -- 32  CASES ( 2 * 2  ORDERED PAIRS OF OPERAND VALUES,
76     --               2    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     IF  NB'(FALSE) =  NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
89     IF      FVAR1  =  NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
90     IF  NB'(FALSE) =      FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
91     IF      FVAR2  =      FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
92
93     IF  NB'(FALSE) =  NB'(TRUE )  THEN  BUMP ;                END IF;
94     IF      FVAR1  =  NB'(TRUE )  THEN  BUMP ;                END IF;
95     IF  NB'(FALSE) =      TVAR2   THEN  BUMP ;                END IF;
96     IF      FVAR2  =      TVAR1   THEN  BUMP ;                END IF;
97
98     IF  NB'(TRUE ) =  NB'(FALSE)  THEN  BUMP ;                END IF;
99     IF  NB'(TRUE ) =      FVAR1   THEN  BUMP ;                END IF;
100     IF      TVAR2  =  NB'(FALSE)  THEN  BUMP ;                END IF;
101     IF      TVAR1  =      FVAR2   THEN  BUMP ;                END IF;
102
103     IF  NB'(TRUE ) =  NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
104     IF      TVAR1  =  NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
105     IF  NB'(TRUE ) =      TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
106     IF      TVAR2  =      TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
107
108
109     IF  NB'(FALSE) /= NB'(FALSE)  THEN  BUMP ;                END IF;
110     IF      FVAR1  /= NB'(FALSE)  THEN  BUMP ;                END IF;
111     IF  NB'(FALSE) /=     FVAR2   THEN  BUMP ;                END IF;
112     IF      FVAR2  /=     FVAR1   THEN  BUMP ;                END IF;
113
114     IF  NB'(FALSE) /= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
115     IF      FVAR1  /= NB'(TRUE )  THEN  NULL ;  ELSE  BUMP ;  END IF;
116     IF  NB'(FALSE) /=     TVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
117     IF      FVAR2  /=     TVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
118
119     IF  NB'(TRUE ) /= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
120     IF  NB'(TRUE ) /=     FVAR1   THEN  NULL ;  ELSE  BUMP ;  END IF;
121     IF      TVAR2  /= NB'(FALSE)  THEN  NULL ;  ELSE  BUMP ;  END IF;
122     IF      TVAR1  /=     FVAR2   THEN  NULL ;  ELSE  BUMP ;  END IF;
123
124     IF  NB'(TRUE ) /= NB'(TRUE )  THEN  BUMP ;                END IF;
125     IF      TVAR1  /= NB'(TRUE )  THEN  BUMP ;                END IF;
126     IF  NB'(TRUE ) /=     TVAR2   THEN  BUMP ;                END IF;
127     IF      TVAR2  /=     TVAR1   THEN  BUMP ;                END IF;
128
129
130     IF  ERROR_COUNT /=0  THEN
131          FAILED( "(IN)EQUALITY OF N_BOOLEAN VALUES - FAILURE1" );
132     END IF;
133
134
135     RESULT ;
136
137
138END C45220C;
139