2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / ada / acats / tests / c4 / c45201a.ada
blob5c1970d34f33957e45956d30a05bf4f7e6649456
1 -- C45201A.ADA
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.
16 -- DISCLAIMER
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 -- ENUMERATION-TYPE OPERANDS (IN PARTICULAR, FOR OPERANDS HAVING
27 -- DIFFERENT SUBTYPES).
29 -- THIS TEST'S FRAMEWORK IS FROM C45201B.ADA , C45210A.ADA .
32 -- RM 20 OCTOBER 1980
33 -- JWC 7/8/85 RENAMED TO -AB
36 WITH REPORT ;
37 PROCEDURE C45201A IS
39 USE REPORT;
41 TYPE T IS ( A , SLIT , B , PLIT , C , NUL , D , 'R' , E );
43 -- S-LIT , P-LIT , NUL , 'R' CORRESPOND
44 -- TO 'S' , 'P' , 'M' , 'R' IN C45210A.
46 SUBTYPE T1 IS T RANGE A..B ;
47 SUBTYPE T2 IS T RANGE A..C ; -- INCLUDES T1
48 SUBTYPE T3 IS T RANGE B..D ; -- INTERSECTS T2 , T4
49 SUBTYPE T4 IS T RANGE C..E ; -- DISJOINT FROM T1 , T2
51 MVAR : T3 := T'(NUL ) ;
52 PVAR : T2 := T'(PLIT) ;
53 RVAR : T4 := T'('R' ) ;
54 SVAR : T1 := T'(SLIT) ;
56 ERROR_COUNT : INTEGER := 0 ; -- INITIAL VALUE ESSENTIAL
58 PROCEDURE BUMP IS
59 BEGIN
60 ERROR_COUNT := ERROR_COUNT + 1 ;
61 END BUMP ;
63 FUNCTION ITSELF( THE_ARGUMENT : T ) RETURN T IS
64 BEGIN
65 IF EQUAL(2,2) THEN RETURN THE_ARGUMENT;
66 ELSE RETURN A ;
67 END IF;
68 END ;
71 BEGIN
73 TEST( "C45201A" , "CHECK THAT '=' AND '/=' PRODUCE CORRECT" &
74 " RESULTS ON ENUMERATION-TYPE LITERALS" ) ;
76 -- 128 CASES ( 4 * 4 ORDERED PAIRS OF OPERAND VALUES,
77 -- 2 (4) OPERATORS (2, TWICE): '=' , '/=' , '=' , '/='
78 -- (IN THE TABLE: A , B , C , D )
79 -- (C45201B.ADA HAD < <= > >= ; REVERSED)
80 -- 4 VARIABLE/LITERAL FOR LEFT OPERAND,
81 -- VARIABLE/LITERAL FOR RIGHT OPERAND,
82 -- (IN THE TABLE: VV = ALPHA ,
83 -- VL = BETA ,
84 -- LV = GAMMA ,
85 -- LL = DELTA ) RANDOMIZED
86 -- INTO 16 (ONE FOR EACH PAIR OF VALUES) ACCORDING TO THE FOL-
87 -- LOWING GRAECO-LATIN SQUARE (WITH ADDITIONAL PROPERTIES):
89 -- RIGHT OPERAND: 'S' 'P' 'M' 'R'
90 -- LEFT
91 -- OPERAND:
93 -- 'S' A-ALPHA B-BETA C-GAMMA D-DELTA
94 -- 'P' C-DELTA D-GAMMA A-BETA B-ALPHA
95 -- 'M' D-BETA C-ALPHA B-DELTA A-GAMMA
96 -- 'R' B-GAMMA A-DELTA D-ALPHA C-BETA
98 -- (BOTH THE LATIN DIAGONAL AND THE GREEK DIAGONAL CONTAIN 4
99 -- DISTINCT LETTERS, NON-TRIVIALLY PERMUTED.)
101 -- THE ABOVE DESCRIBES PART 1 OF THE TEST. PART 2 PERFORMS AN
102 -- EXHAUSTIVE VERIFICATION OF THE 'VARIABLE VS. VARIABLE' CASE
103 -- ( VV , ALPHA ) FOR BOTH OPERATORS.
105 -----------------------------------------------------------------
107 -- PART 1
109 -- 'BUMP' MEANS 'BUMP THE ERROR COUNT'
111 IF T'(SVAR) = T'(SVAR) THEN NULL; ELSE BUMP ; END IF;
112 IF T'(SVAR) /= T'(PLIT) THEN NULL; ELSE BUMP ; END IF;
113 IF T'(SLIT) = T'(MVAR) THEN BUMP ; END IF;
114 IF T'(SLIT) /= T'('R' ) THEN NULL; ELSE BUMP ; END IF;
116 IF T'(PLIT) = T'(SLIT) THEN BUMP ; END IF;
117 IF T'(PLIT) /= T'(PVAR) THEN BUMP ; END IF;
118 IF T'(PVAR) = T'(NUL ) THEN BUMP ; END IF;
119 IF T'(PVAR) /= T'(RVAR) THEN NULL; ELSE BUMP ; END IF;
121 IF T'(MVAR) /= T'(SLIT) THEN NULL; ELSE BUMP ; END IF;
122 IF T'(MVAR) = T'(PVAR) THEN BUMP ; END IF;
123 IF T'(NUL ) /= T'(NUL ) THEN BUMP ; END IF;
124 IF T'(NUL ) = T'(RVAR) THEN BUMP ; END IF;
126 IF T'('R' ) /= T'(SVAR) THEN NULL; ELSE BUMP ; END IF;
127 IF T'('R' ) = T'(PLIT) THEN BUMP ; END IF;
128 IF T'(RVAR) /= T'(MVAR) THEN NULL; ELSE BUMP ; END IF;
129 IF T'(RVAR) = T'('R' ) THEN NULL; ELSE BUMP ; END IF;
132 IF ERROR_COUNT /= 0 THEN
133 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE1" );
134 END IF;
136 -----------------------------------------------------------------
138 -- PART 2
140 -- 'BUMP' STILL MEANS 'BUMP THE ERROR COUNT'
142 ERROR_COUNT := 0 ;
144 FOR AVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
145 FOR BVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
147 IF AVAR = BVAR THEN
148 IF AVAR /= BVAR THEN BUMP ; END IF;
149 END IF;
151 IF AVAR /= BVAR THEN
152 IF AVAR = BVAR THEN BUMP ; END IF;
153 END IF;
155 END LOOP;
156 END LOOP;
158 IF ERROR_COUNT /= 0 THEN
159 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE2" );
160 END IF;
163 ERROR_COUNT := 0 ;
165 FOR AVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
167 FOR BVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
169 IF ( AVAR /= BVAR ) /= ( T'POS(AVAR) /= T'POS(BVAR) )THEN
170 BUMP ;
171 END IF;
173 IF ( AVAR = BVAR ) /= ( T'POS(AVAR) = T'POS(BVAR) )THEN
174 BUMP ;
175 END IF;
177 END LOOP;
179 END LOOP;
181 IF ERROR_COUNT /= 0 THEN
182 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE3" );
183 END IF;
185 ERROR_COUNT := 0 ;
187 FOR IVAR IN 0..8 LOOP -- 9 VALUES
189 FOR JVAR IN 0..8 LOOP -- 9 VALUES
191 IF ( IVAR /= JVAR ) /= ( T'VAL(IVAR) /= T'VAL(JVAR) )THEN
192 BUMP ;
193 END IF;
195 IF ( IVAR = JVAR ) /= ( T'VAL(IVAR) = T'VAL(JVAR) )THEN
196 BUMP ;
197 END IF;
199 END LOOP;
201 END LOOP;
203 IF ERROR_COUNT /= 0 THEN
204 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE4" );
205 END IF;
208 ERROR_COUNT := 0 ;
210 FOR AVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES (THE DIAGONAL)
212 IF AVAR = ITSELF(AVAR) THEN NULL; ELSE BUMP; END IF;
213 IF AVAR /= ITSELF(AVAR) THEN BUMP; END IF;
215 END LOOP;
217 IF ERROR_COUNT /= 0 THEN
218 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE5" );
219 END IF;
222 -- 'BUMP' MEANS 'INCREASE THE COUNT FOR THE NUMBER OF <TRUE>S'
224 ERROR_COUNT := 0 ;
226 FOR AVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
227 FOR BVAR IN T'FIRST..T'LAST LOOP -- 9 VALUES
229 IF AVAR /= BVAR THEN BUMP ; END IF; -- COUNT +:= 72
231 END LOOP;
232 END LOOP;
234 IF ERROR_COUNT /= 72 THEN -- THIS IS A PLAIN COUNT, NOT AN
235 -- ERROR COUNT
236 FAILED( "EQUALITY OF ENUMERATION VALUES - FAILURE6" );
237 END IF;
240 RESULT;
242 END C45201A;