OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c3/] [c32111a.ada] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- C32111A.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
-- OBJECTIVE:
26
-- CHECK THAT WHEN A VARIABLE OR CONSTANT HAVING AN ENUMERATION,
27
--    INTEGER, FLOAT OR FIXED TYPE IS DECLARED WITH AN INITIAL VALUE,
28
--    CONSTRAINT_ERROR IS RAISED IF THE INITIAL VALUE LIES OUTSIDE THE
29
--    RANGE OF THE SUBTYPE.
30
 
31
-- HISTORY:
32
--    RJW 07/20/86  CREATED ORIGINAL TEST.
33
--    JET 08/04/87  IMPROVED DEFEAT OF COMPILER OPTIMIZATION.
34
 
35
WITH REPORT; USE REPORT;
36
 
37
PROCEDURE C32111A IS
38
 
39
     TYPE WEEKDAY IS (MON, TUES, WED, THURS, FRI);
40
     SUBTYPE MIDWEEK IS WEEKDAY RANGE WED .. WED;
41
 
42
     SUBTYPE DIGIT IS CHARACTER RANGE '0' .. '9';
43
 
44
     SUBTYPE SHORT IS INTEGER RANGE -100 .. 100;
45
 
46
     TYPE INT IS RANGE -10 .. 10;
47
     SUBTYPE PINT IS INT RANGE 1 .. 10;
48
 
49
     TYPE FLT IS DIGITS 3 RANGE -5.0 .. 5.0;
50
     SUBTYPE SFLT IS FLT RANGE -5.0 .. 0.0;
51
 
52
     TYPE FIXED IS DELTA 0.5 RANGE -5.0 .. 5.0;
53
     SUBTYPE SFIXED IS FIXED RANGE 0.0 .. 5.0;
54
 
55
BEGIN
56
     TEST ("C32111A", "CHECK THAT WHEN A VARIABLE OR CONSTANT " &
57
                      "HAVING AN ENUMERATION, INTEGER, FLOAT OR " &
58
                      "FIXED TYPE IS DECLARED WITH AN INITIAL " &
59
                      "VALUE, CONSTRAINT_ERROR IS RAISED IF THE " &
60
                      "INITIAL VALUE LIES OUTSIDE THE RANGE OF THE " &
61
                      "SUBTYPE" );
62
 
63
     BEGIN
64
          DECLARE
65
               D : MIDWEEK := WEEKDAY'VAL (IDENT_INT (1));
66
          BEGIN
67
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
68
                        "OF VARIABLE 'D'" );
69
               IF D = TUES THEN
70
                    COMMENT ("VARIABLE 'D' INITIALIZED");
71
               END IF;
72
          END;
73
     EXCEPTION
74
          WHEN CONSTRAINT_ERROR =>
75
               NULL;
76
          WHEN OTHERS =>
77
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
78
                        "OF VARIABLE 'D'" );
79
     END;
80
 
81
     BEGIN
82
          DECLARE
83
               D : CONSTANT WEEKDAY RANGE WED .. WED :=
84
                   WEEKDAY'VAL (IDENT_INT (3));
85
          BEGIN
86
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
87
                        "OF CONSTANT 'D'" );
88
               IF D = TUES THEN
89
                    COMMENT ("INITIALIZE VARIABLE 'D'");
90
               END IF;
91
          END;
92
     EXCEPTION
93
          WHEN CONSTRAINT_ERROR =>
94
               NULL;
95
          WHEN OTHERS =>
96
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
97
                        "OF CONSTANT 'D'" );
98
     END;
99
 
100
     BEGIN
101
          DECLARE
102
               P : CONSTANT DIGIT := IDENT_CHAR ('/');
103
          BEGIN
104
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
105
                        "OF CONSTANT 'P'" );
106
               IF P = '0' THEN
107
                    COMMENT ("VARIABLE 'P' INITIALIZED");
108
               END IF;
109
          END;
110
     EXCEPTION
111
          WHEN CONSTRAINT_ERROR =>
112
               NULL;
113
          WHEN OTHERS =>
114
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
115
                        "OF CONSTANT 'P'" );
116
     END;
117
 
118
     BEGIN
119
          DECLARE
120
               Q : CHARACTER RANGE 'A' .. 'E' := IDENT_CHAR ('F');
121
          BEGIN
122
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
123
                        "OF VARIABLE 'Q'" );
124
               IF Q = 'A' THEN
125
                    COMMENT ("VARIABLE 'Q' INITIALIZED");
126
               END IF;
127
          END;
128
     EXCEPTION
129
          WHEN CONSTRAINT_ERROR =>
130
               NULL;
131
          WHEN OTHERS =>
132
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
133
                        "OF VARIABLE 'Q'" );
134
     END;
135
 
136
     BEGIN
137
          DECLARE
138
               I  :  SHORT := IDENT_INT (-101);
139
          BEGIN
140
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
141
                        "OF VARIABLE 'I'" );
142
               IF I = 1 THEN
143
                    COMMENT ("VARIABLE 'I' INITIALIZED");
144
               END IF;
145
          END;
146
     EXCEPTION
147
          WHEN CONSTRAINT_ERROR =>
148
               NULL;
149
          WHEN OTHERS =>
150
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
151
                        "OF VARIABLE 'I'" );
152
     END;
153
 
154
     BEGIN
155
          DECLARE
156
               J  : CONSTANT INTEGER RANGE 0 .. 100 := IDENT_INT (101);
157
          BEGIN
158
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
159
                        "OF CONSTANT 'J'" );
160
               IF J = -1 THEN
161
                    COMMENT ("VARIABLE 'J' INITIALIZED");
162
               END IF;
163
          END;
164
     EXCEPTION
165
          WHEN CONSTRAINT_ERROR =>
166
               NULL;
167
          WHEN OTHERS =>
168
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
169
                        "OF CONSTANT 'J'" );
170
     END;
171
 
172
     BEGIN
173
          DECLARE
174
               K  : INT RANGE 0 .. 1 := INT (IDENT_INT (2));
175
          BEGIN
176
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
177
                        "OF VARIABLE 'K'" );
178
               IF K = 2 THEN
179
                    COMMENT ("VARIABLE 'K' INITIALIZED");
180
               END IF;
181
          END;
182
     EXCEPTION
183
          WHEN CONSTRAINT_ERROR =>
184
               NULL;
185
          WHEN OTHERS =>
186
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
187
                        "OF VARIABLE 'K'" );
188
     END;
189
 
190
     BEGIN
191
          DECLARE
192
               L  : CONSTANT PINT := INT (IDENT_INT (0));
193
          BEGIN
194
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
195
                        "OF CONSTANT 'L'" );
196
               IF L = 1 THEN
197
                    COMMENT ("VARIABLE 'L' INITIALIZED");
198
               END IF;
199
          END;
200
     EXCEPTION
201
          WHEN CONSTRAINT_ERROR =>
202
               NULL;
203
          WHEN OTHERS =>
204
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
205
                        "OF CONSTANT 'L'" );
206
     END;
207
 
208
     BEGIN
209
          DECLARE
210
               FL : SFLT := FLT (IDENT_INT (1));
211
          BEGIN
212
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
213
                        "OF VARIABLE 'FL'" );
214
               IF FL = 3.14 THEN
215
                    COMMENT ("VARIABLE 'FL' INITIALIZED");
216
               END IF;
217
          END;
218
     EXCEPTION
219
          WHEN CONSTRAINT_ERROR =>
220
               NULL;
221
          WHEN OTHERS =>
222
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
223
                        "OF VARIABLE 'FL'" );
224
     END;
225
 
226
     BEGIN
227
          DECLARE
228
               FL1 : CONSTANT FLT RANGE 0.0 .. 0.0 :=
229
                     FLT (IDENT_INT (-1));
230
          BEGIN
231
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
232
                        "OF CONSTANT 'FL1'" );
233
               IF FL1 = 0.0 THEN
234
                    COMMENT ("VARIABLE 'FL1' INITIALIZED");
235
               END IF;
236
          END;
237
     EXCEPTION
238
          WHEN CONSTRAINT_ERROR =>
239
               NULL;
240
          WHEN OTHERS =>
241
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
242
                        "OF CONSTANT 'FL1'" );
243
     END;
244
 
245
     BEGIN
246
          DECLARE
247
               FI : FIXED RANGE 0.0 .. 0.0 := IDENT_INT (1) * 0.5;
248
          BEGIN
249
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
250
                        "OF VARIABLE 'FI'" );
251
               IF FI = 0.5 THEN
252
                    COMMENT ("VARIABLE 'FI' INITIALIZED");
253
               END IF;
254
          END;
255
     EXCEPTION
256
          WHEN CONSTRAINT_ERROR =>
257
               NULL;
258
          WHEN OTHERS =>
259
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
260
                        "OF VARIABLE 'FI'" );
261
     END;
262
 
263
     BEGIN
264
          DECLARE
265
               FI1 : CONSTANT SFIXED := IDENT_INT (-1) * 0.5;
266
          BEGIN
267
               FAILED ( "NO EXCEPTION RAISED FOR INITIALIZATION " &
268
                        "OF CONSTANT 'FI1'" );
269
               IF FI1 = 0.5 THEN
270
                    COMMENT ("VARIABLE 'FI1' INITIALIZED");
271
               END IF;
272
          END;
273
     EXCEPTION
274
          WHEN CONSTRAINT_ERROR =>
275
               NULL;
276
          WHEN OTHERS =>
277
               FAILED ( "WRONG EXCEPTION RAISED FOR INITIALIZATION " &
278
                        "OF CONSTANT 'FI1'" );
279
     END;
280
 
281
     RESULT;
282
END C32111A;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.