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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [ce/] [ce2401b.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CE2401B.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 READ (WITH AND WITHOUT PARAMETER FROM), WRITE (WITH
27
--     AND WITHOUT PARAMETER TO), SET_INDEX, INDEX, SIZE, AND
28
--     END_OF_FILE FOR DIRECT FILES WITH ELEMENT_TYPES BOOLEAN,
29
--     ACCESS, AND ENUMERATED.
30
 
31
-- APPLICABILITY CRITERIA:
32
--     THIS TEST IS ONLY APPLICABLE TO IMPLEMENTATIONS WHICH SUPPORT
33
--     DIRECT FILES.
34
 
35
-- HISTORY:
36
--     ABW 08/18/82
37
--     SPS 09/15/82
38
--     SPS 11/09/82
39
--     JBG 02/22/84  CHANGE TO .ADA TEST.
40
--     EG  05/16/85
41
--     TBN 11/04/86  REVISED TEST TO OUTPUT A NON_APPLICABLE
42
--                   RESULT WHEN FILES ARE NOT SUPPORTED.
43
--     DWC 08/07/87  ISOLATED EXCEPTIONS.
44
 
45
WITH REPORT; USE REPORT;
46
WITH DIRECT_IO;
47
 
48
PROCEDURE CE2401B IS
49
     END_SUBTEST : EXCEPTION;
50
BEGIN
51
 
52
     TEST ("CE2401B", "CHECK READ, WRITE, SET_INDEX " &
53
                      "INDEX, SIZE, AND END_OF_FILE FOR " &
54
                      "DIRECT FILES FOR BOOLEAN, ACCESS " &
55
                      "AND ENUMERATION TYPES");
56
     DECLARE
57
          PACKAGE DIR_BOOL IS NEW DIRECT_IO (BOOLEAN);
58
          USE DIR_BOOL;
59
          FILE_BOOL : FILE_TYPE;
60
     BEGIN
61
          BEGIN
62
               CREATE (FILE_BOOL, INOUT_FILE, LEGAL_FILE_NAME);
63
          EXCEPTION
64
               WHEN USE_ERROR | NAME_ERROR =>
65
                    NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
66
                                    "ON CREATE - BOOLEAN");
67
                    RAISE END_SUBTEST;
68
               WHEN OTHERS =>
69
                    FAILED ("UNEXPECTED ERROR RAISED ON " &
70
                            "CREATE - BOOLEAN");
71
                    RAISE END_SUBTEST;
72
          END;
73
 
74
          DECLARE
75
               BOOL : BOOLEAN := IDENT_BOOL (TRUE);
76
               ITEM_BOOL : BOOLEAN;
77
               ONE_BOOL : POSITIVE_COUNT := 1;
78
               TWO_BOOL : POSITIVE_COUNT := 2;
79
          BEGIN
80
               BEGIN
81
                    WRITE (FILE_BOOL,BOOL);
82
               EXCEPTION
83
                    WHEN OTHERS =>
84
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
85
                                 "BOOLEAN - 1");
86
               END;
87
 
88
               BEGIN
89
                    WRITE (FILE_BOOL,BOOL,TWO_BOOL);
90
               EXCEPTION
91
                    WHEN OTHERS =>
92
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
93
                                 "BOOLEAN - 2");
94
               END;
95
 
96
               BEGIN
97
                    IF SIZE (FILE_BOOL) /= TWO_BOOL THEN
98
                         FAILED ("SIZE FOR TYPE BOOLEAN");
99
                    END IF;
100
                    IF NOT END_OF_FILE (FILE_BOOL) THEN
101
                         FAILED ("WRONG END_OF_FILE VALUE FOR " &
102
                                 "BOOLEAN");
103
                    END IF;
104
                    SET_INDEX (FILE_BOOL,ONE_BOOL);
105
                    IF INDEX (FILE_BOOL) /= ONE_BOOL THEN
106
                         FAILED ("WRONG INDEX VALUE FOR TYPE BOOLEAN");
107
                    END IF;
108
               END;
109
 
110
               CLOSE (FILE_BOOL);
111
 
112
               BEGIN
113
                    OPEN (FILE_BOOL, IN_FILE, LEGAL_FILE_NAME);
114
               EXCEPTION
115
                    WHEN USE_ERROR =>
116
                         NOT_APPLICABLE ("OPEN FOR IN_FILE MODE " &
117
                                         "NOT SUPPORTED - 1");
118
                         RAISE END_SUBTEST;
119
               END;
120
 
121
               BEGIN
122
                    READ (FILE_BOOL,ITEM_BOOL);
123
                    IF ITEM_BOOL /= BOOL THEN
124
                         FAILED ("INCORRECT BOOLEAN VALUE READ - 1");
125
                    END IF;
126
               EXCEPTION
127
                    WHEN OTHERS =>
128
                         FAILED ("READ WITHOUT FROM FOR " &
129
                                 "TYPE BOOLEAN");
130
               END;
131
 
132
               BEGIN
133
                    READ (FILE_BOOL,ITEM_BOOL,ONE_BOOL);
134
                    IF ITEM_BOOL /= BOOL THEN
135
                         FAILED ("INCORRECT BOOLEAN VALUE READ - 2");
136
                    END IF;
137
               EXCEPTION
138
                    WHEN OTHERS =>
139
                         FAILED ("READ WITH FROM FOR BOOLEAN");
140
               END;
141
          END;
142
 
143
          BEGIN
144
               DELETE (FILE_BOOL);
145
          EXCEPTION
146
               WHEN USE_ERROR =>
147
                    NULL;
148
          END;
149
 
150
     EXCEPTION
151
          WHEN END_SUBTEST =>
152
               NULL;
153
     END;
154
 
155
     DECLARE
156
          TYPE ENUMERATED IS (ONE,TWO,THREE);
157
          PACKAGE DIR_ENUM IS NEW DIRECT_IO (ENUMERATED);
158
          USE DIR_ENUM;
159
          FILE_ENUM : FILE_TYPE;
160
     BEGIN
161
          BEGIN
162
               CREATE (FILE_ENUM, INOUT_FILE, LEGAL_FILE_NAME(2));
163
          EXCEPTION
164
               WHEN USE_ERROR | NAME_ERROR =>
165
                    NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
166
                                    "ON CREATE - ENUMERATED");
167
                    RAISE END_SUBTEST;
168
               WHEN OTHERS =>
169
                    FAILED ("UNEXPECTED ERROR RAISED ON " &
170
                            "CREATE - ENUMERATED");
171
                    RAISE END_SUBTEST;
172
          END;
173
 
174
          DECLARE
175
               ENUM : ENUMERATED := (THREE);
176
               ITEM_ENUM : ENUMERATED;
177
               ONE_ENUM : POSITIVE_COUNT := 1;
178
               TWO_ENUM : POSITIVE_COUNT := 2;
179
          BEGIN
180
               BEGIN
181
                    WRITE (FILE_ENUM,ENUM);
182
               EXCEPTION
183
                    WHEN OTHERS =>
184
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
185
                                 "ENUMERATED - 1");
186
               END;
187
 
188
               BEGIN
189
                    WRITE (FILE_ENUM,ENUM,TWO_ENUM);
190
               EXCEPTION
191
                    WHEN OTHERS =>
192
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
193
                                 "ENUMERATED - 2");
194
               END;
195
 
196
               BEGIN
197
                    IF SIZE (FILE_ENUM) /= TWO_ENUM THEN
198
                         FAILED ("SIZE FOR TYPE ENUMERATED");
199
                    END IF;
200
                    IF NOT END_OF_FILE (FILE_ENUM) THEN
201
                         FAILED ("WRONG END_OF_FILE VALUE FOR TYPE " &
202
                                 "ENUMERATED");
203
                    END IF;
204
                    SET_INDEX (FILE_ENUM,ONE_ENUM);
205
                    IF INDEX (FILE_ENUM) /= ONE_ENUM THEN
206
                         FAILED ("WRONG INDEX VALUE FOR TYPE " &
207
                                 "ENUMERATED");
208
                    END IF;
209
               END;
210
 
211
               CLOSE (FILE_ENUM);
212
 
213
               BEGIN
214
                    OPEN (FILE_ENUM, IN_FILE, LEGAL_FILE_NAME(2));
215
               EXCEPTION
216
                    WHEN USE_ERROR =>
217
                         NOT_APPLICABLE ("OPEN FOR IN_FILE MODE " &
218
                                         "NOT SUPPORTED - 2");
219
                    RAISE END_SUBTEST;
220
               END;
221
 
222
               BEGIN
223
                    READ (FILE_ENUM,ITEM_ENUM);
224
                    IF ITEM_ENUM /= ENUM THEN
225
                         FAILED ("INCORRECT ENUM VALUE READ - 1");
226
                    END IF;
227
               EXCEPTION
228
                    WHEN OTHERS =>
229
                         FAILED ("READ WITHOUT FROM FOR ENUMERATED");
230
               END;
231
 
232
               BEGIN
233
                    READ (FILE_ENUM,ITEM_ENUM,ONE_ENUM);
234
                    IF ITEM_ENUM /= ENUM THEN
235
                         FAILED ("INCORRECT ENUM VALUE READ - 2");
236
                    END IF;
237
               EXCEPTION
238
                    WHEN OTHERS =>
239
                         FAILED ("READ WITH FROM FOR " &
240
                                 "TYPE ENUMERATED");
241
               END;
242
          END;
243
 
244
          BEGIN
245
               DELETE (FILE_ENUM);
246
          EXCEPTION
247
               WHEN USE_ERROR =>
248
                    NULL;
249
          END;
250
 
251
     EXCEPTION
252
          WHEN END_SUBTEST =>
253
               NULL;
254
     END;
255
 
256
     DECLARE
257
          TYPE ACC_INT IS ACCESS INTEGER;
258
          PACKAGE DIR_ACC IS NEW DIRECT_IO (ACC_INT);
259
          USE DIR_ACC;
260
          FILE_ACC : FILE_TYPE;
261
     BEGIN
262
          BEGIN
263
               CREATE (FILE_ACC, INOUT_FILE, LEGAL_FILE_NAME(3));
264
          EXCEPTION
265
               WHEN USE_ERROR | NAME_ERROR =>
266
                    NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
267
                                    "ON CREATE - ACCESS");
268
                    RAISE END_SUBTEST;
269
          END;
270
 
271
          DECLARE
272
               ACC : ACC_INT := NEW INTEGER'(33);
273
               ITEM_ACC : ACC_INT;
274
               ONE_ACC : POSITIVE_COUNT := 1;
275
               TWO_ACC : POSITIVE_COUNT := 2;
276
          BEGIN
277
               BEGIN
278
                    WRITE (FILE_ACC,ACC);
279
               EXCEPTION
280
                    WHEN OTHERS =>
281
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
282
                                 "ACCESS - 1");
283
               END;
284
 
285
               BEGIN
286
                    WRITE (FILE_ACC,ACC,TWO_ACC);
287
 
288
               EXCEPTION
289
                    WHEN OTHERS =>
290
                         FAILED ("EXCEPTION RAISED ON WRITE FOR " &
291
                                 "ACCESS - 2");
292
               END;
293
 
294
               BEGIN
295
                    IF SIZE (FILE_ACC) /= TWO_ACC THEN
296
                         FAILED ("SIZE FOR TYPE ACCESS");
297
                    END IF;
298
                    IF NOT END_OF_FILE (FILE_ACC) THEN
299
                         FAILED ("WRONG END_OF_FILE VALUE FOR ACCESS");
300
                    END IF;
301
                    SET_INDEX (FILE_ACC,ONE_ACC);
302
                    IF INDEX (FILE_ACC) /= ONE_ACC THEN
303
                         FAILED ("WRONG INDEX VALUE FOR TYPE ACCESS");
304
                    END IF;
305
               END;
306
 
307
               CLOSE (FILE_ACC);
308
 
309
               BEGIN
310
                    OPEN (FILE_ACC, IN_FILE, LEGAL_FILE_NAME(3));
311
               EXCEPTION
312
                    WHEN USE_ERROR =>
313
                         NOT_APPLICABLE ("OPEN FOR IN_FILE NOT " &
314
                                         "SUPPORTED - 3");
315
                         RAISE END_SUBTEST;
316
               END;
317
 
318
               BEGIN
319
                    READ (FILE_ACC,ITEM_ACC);
320
               EXCEPTION
321
                    WHEN OTHERS =>
322
                         FAILED ("READ WITHOUT FROM FOR ACCESS");
323
               END;
324
 
325
               BEGIN
326
                    READ (FILE_ACC,ITEM_ACC,ONE_ACC);
327
               EXCEPTION
328
                    WHEN OTHERS =>
329
                         FAILED ("READ WITH FROM FOR ACCESS");
330
               END;
331
          END;
332
 
333
          BEGIN
334
               DELETE (FILE_ACC);
335
          EXCEPTION
336
               WHEN USE_ERROR =>
337
                    NULL;
338
          END;
339
 
340
     EXCEPTION
341
          WHEN END_SUBTEST =>
342
               NULL;
343
     END;
344
 
345
     RESULT;
346
 
347
END CE2401B;

powered by: WebSVN 2.1.0

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