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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [ce/] [ce2201g.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CE2201G.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 READ, WRITE, AND END_OF_FILE ARE SUPPORTED
27
--      FOR SEQUENTIAL FILES WITH VARIANT RECORDS WITH DEFAULT
28
--      DISCRIMINANTS.
29
 
30
-- APPLICABILITY CRITERIA:
31
--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
32
--     SEQUENTIAL FILES.
33
 
34
-- HISTORY:
35
--     TBN 05/15/86
36
--     TBN 11/04/86  REVISED TEST TO OUTPUT A NOT_APPLICABLE
37
--                   RESULT WHEN FILES ARE NOT SUPPORTED.
38
--     JLH 08/03/87  REMOVED DEPENDENCE OF RESET AND CREATED EXTERNAL
39
--                   FILES RATHER THAN TEMPORARY FILES.
40
 
41
WITH REPORT; USE REPORT;
42
WITH SEQUENTIAL_IO;
43
 
44
PROCEDURE CE2201G IS
45
 
46
BEGIN
47
 
48
     TEST ("CE2201G", "CHECK THAT READ, WRITE, AND END_OF_FILE " &
49
                      "ARE SUPPORTED FOR SEQUENTIAL FILES WITH " &
50
                      "UNCONSTRAINED VARIANT RECORD TYPES WITH " &
51
                      "DEFAULT DISCRIMINANTS.");
52
 
53
     DECLARE
54
          TYPE VAR_REC (DISCR : BOOLEAN := TRUE) IS
55
               RECORD
56
                    CASE DISCR IS
57
                         WHEN TRUE =>
58
                              A : INTEGER;
59
                         WHEN FALSE =>
60
                              B : STRING (1..20);
61
                    END CASE;
62
               END RECORD;
63
 
64
          PACKAGE SEQ_VAR_REC IS NEW SEQUENTIAL_IO (VAR_REC);
65
          USE SEQ_VAR_REC;
66
 
67
          FILE_VAR_REC : FILE_TYPE;
68
          INCOMPLETE : EXCEPTION;
69
          ITEM_TRUE : VAR_REC(TRUE);     -- CONSTRAINED
70
          ITEM      : VAR_REC;           -- UNCONSTRAINED
71
 
72
     BEGIN
73
          BEGIN
74
               CREATE (FILE_VAR_REC, OUT_FILE, LEGAL_FILE_NAME);
75
          EXCEPTION
76
               WHEN USE_ERROR | NAME_ERROR =>
77
                    NOT_APPLICABLE ("CREATE OF SEQUENTIAL FILE WITH " &
78
                                    "MODE OUT_FILE NOT SUPPORTED");
79
                    RAISE INCOMPLETE;
80
          END;
81
 
82
          WRITE (FILE_VAR_REC, (TRUE, -5));
83
          WRITE (FILE_VAR_REC, (FALSE, (1..20 => 'B')));
84
          CLOSE (FILE_VAR_REC);
85
 
86
          BEGIN
87
               OPEN (FILE_VAR_REC, IN_FILE, LEGAL_FILE_NAME);
88
          EXCEPTION
89
               WHEN USE_ERROR =>
90
                    NOT_APPLICABLE ("OPEN OF SEQUENTIAL FILE WITH " &
91
                                    "MODE IN_FILE NOT SUPPORTED");
92
                    RAISE INCOMPLETE;
93
          END;
94
 
95
          IF END_OF_FILE (FILE_VAR_REC) THEN
96
               FAILED ("WRONG END_OF_FILE VALUE FOR RECORD" &
97
                       "WITH DISCRIMINANT");
98
          END IF;
99
 
100
          BEGIN
101
               READ (FILE_VAR_REC, ITEM_TRUE);
102
 
103
               IF ITEM_TRUE /= (TRUE, IDENT_INT(-5)) THEN
104
                    FAILED ("READ WRONG VALUE - 1");
105
               END IF;
106
 
107
               IF END_OF_FILE (FILE_VAR_REC) THEN
108
                    FAILED ("PREMATURE END OF FILE");
109
               END IF;
110
 
111
               READ (FILE_VAR_REC, ITEM);
112
 
113
               IF ITEM /= (FALSE, (1..IDENT_INT(20) => 'B')) THEN
114
                    FAILED ("READ WRONG VALUE - 2");
115
               END IF;
116
 
117
               IF NOT END_OF_FILE(FILE_VAR_REC) THEN
118
                    FAILED ("NOT AT END OF FILE");
119
               END IF;
120
 
121
          END;
122
 
123
          BEGIN
124
               DELETE (FILE_VAR_REC);
125
          EXCEPTION
126
               WHEN USE_ERROR =>
127
                    NULL;
128
          END;
129
 
130
     EXCEPTION
131
          WHEN INCOMPLETE =>
132
               NULL;
133
 
134
     END;
135
 
136
     RESULT;
137
 
138
END CE2201G;

powered by: WebSVN 2.1.0

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