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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- CE3905C.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 GET FOR ENUMERATION TYPES RAISES DATA_ERROR WHEN THE
27
--     ELEMENT RETRIEVED IS NOT OF THE TYPE EXPECTED OR IS OUT OF THE
28
--     RANGE OF A SUBTYPE.  ALSO CHECK THAT CONSTRAINT_ERROR IS RAISED
29
--     IF THE VALUE READ IS OUT OF RANGE OF THE ITEM PARAMETER, BUT
30
--     WITHIN THE RANGE OF THE INSTANTIATED TYPE.
31
 
32
-- APPLICABILITY CRITERIA:
33
--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH
34
--     SUPPORT TEXT FILES.
35
 
36
-- HISTORY:
37
--     SPS 10/08/82
38
--     SPS 12/14/82
39
--     JBG 02/22/84  CHANGED TO .ADA TEST.
40
--     TBN 11/10/86  REVISED TEST TO OUTPUT A NON_APPLICABLE
41
--                   RESULT WHEN FILES ARE NOT SUPPORTED.
42
--     DWC 09/16/87  REMOVED DEPENDENCE ON RESET AND CORRECTED
43
--                   EXCEPTION HANDLING.
44
 
45
WITH REPORT;
46
USE REPORT;
47
WITH TEXT_IO;
48
USE TEXT_IO;
49
 
50
PROCEDURE CE3905C IS
51
     INCOMPLETE : EXCEPTION;
52
 
53
BEGIN
54
 
55
     TEST ("CE3905C", "CHECK THAT GET FOR ENUMERATION TYPES RAISES " &
56
                      "DATA_ERROR WHEN THE ELEMENT RETRIEVED IS NOT " &
57
                      "OF THE TYPE EXPECTED OR IS OUT OF THE RANGE " &
58
                      "OF A SUBTYPE.  ALSO CHECK THAT " &
59
                      "CONSTRAINT_ERROR IS RAISED IF THE VALUE READ " &
60
                      "IS OUT OF RANGE OF THE ITEM PARAMETER, BUT " &
61
                      "WITHIN THE RANGE OF THE INSTANTIATED TYPE");
62
 
63
     DECLARE
64
          FT : FILE_TYPE;
65
          TYPE COLOR IS (RED, BLUE, YELLOW, WHITE, ORANGE, GREEN,
66
                         PURPLE, BLACK);
67
          SUBTYPE P_COLOR IS COLOR RANGE RED .. YELLOW;
68
          CRAYON : COLOR := BLACK;
69
          PAINT : P_COLOR := BLUE;
70
          ST : STRING (1 .. 2);
71
          PACKAGE COLOR_IO IS NEW ENUMERATION_IO (COLOR);
72
          USE COLOR_IO;
73
     BEGIN
74
 
75
-- CREATE AND INITIALIZE DATA FILE
76
 
77
          BEGIN
78
               CREATE (FT, OUT_FILE, LEGAL_FILE_NAME);
79
          EXCEPTION
80
               WHEN USE_ERROR =>
81
                    NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " &
82
                                    "WITH OUT_FILE MODE");
83
                    RAISE INCOMPLETE;
84
               WHEN NAME_ERROR =>
85
                    NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " &
86
                                    "WITH OUT_FILE MODE");
87
                    RAISE INCOMPLETE;
88
          END;
89
 
90
          PUT (FT, "BROWN");
91
          NEW_LINE (FT);
92
          PUT (FT, "ORANGE");
93
          NEW_LINE (FT);
94
          PUT (FT, "GREEN");
95
          NEW_LINE (FT);
96
          PUT (FT, "WHITE");
97
          NEW_LINE (FT);
98
          PUT (FT, "WHI");
99
          NEW_LINE (FT);
100
          PUT (FT, "TE");
101
          NEW_LINE (FT);
102
          PUT (FT, "RED");
103
 
104
          CLOSE (FT);
105
 
106
          BEGIN
107
               OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
108
          EXCEPTION
109
               WHEN USE_ERROR =>
110
                    NOT_APPLICABLE ("USE_ERROR RAISED; OPEN WITH " &
111
                             "IN_FILE MODE");
112
                    RAISE INCOMPLETE;
113
          END;
114
 
115
-- START TEST
116
 
117
          BEGIN
118
               GET (FT, CRAYON);                  -- BROWN
119
               FAILED ("DATA_ERROR NOT RAISED - 1");
120
          EXCEPTION
121
               WHEN DATA_ERROR =>
122
                    IF CRAYON /= BLACK THEN
123
                         FAILED ("ITEM CRAYON AFFECTED - 1");
124
                    END IF;
125
               WHEN OTHERS =>
126
                    FAILED ("WRONG EXCEPTION RAISED - 1");
127
          END;
128
 
129
          BEGIN
130
               GET (FT, PAINT);                   -- ORANGE
131
               FAILED ("CONSTRAINT_ERROR NOT RAISED");
132
          EXCEPTION
133
               WHEN CONSTRAINT_ERROR =>
134
                    IF PAINT /= BLUE THEN
135
                         FAILED ("ITEM PAINT AFFECTED - 2");
136
                    END IF;
137
               WHEN DATA_ERROR =>
138
                    FAILED ("DATA_ERROR RAISED FOR ITEM SUBTYPE");
139
               WHEN OTHERS =>
140
                    FAILED ("WRONG EXCEPTION RAISED - 2");
141
          END;
142
 
143
          DECLARE
144
               PACKAGE P_COLOR_IO IS NEW ENUMERATION_IO (P_COLOR);
145
               USE P_COLOR_IO;
146
          BEGIN
147
               BEGIN
148
                    P_COLOR_IO.GET (FT, PAINT);   -- GREEN
149
                    FAILED ("DATA_ERROR NOT RAISED - 3");
150
               EXCEPTION
151
                    WHEN DATA_ERROR =>
152
                         IF PAINT /= BLUE THEN
153
                              FAILED ("ITEM PAINT AFFECTED - 3");
154
                         END IF;
155
                    WHEN OTHERS =>
156
                         FAILED ("WRONG EXCEPTION RAISED - 3");
157
               END;
158
 
159
               BEGIN
160
                    P_COLOR_IO.GET (FT, PAINT);   -- WHITE
161
                    FAILED ("DATA_ERROR NOT RAISED - 3A");
162
               EXCEPTION
163
                    WHEN DATA_ERROR =>
164
                         NULL;
165
                    WHEN OTHERS =>
166
                         FAILED ("WRONG EXCEPTION RAISED - 3A");
167
               END;
168
          END;
169
 
170
          BEGIN
171
               GET (FT, CRAYON);                  -- WHI
172
               FAILED ("DATA_ERROR NOT RAISED - 4");
173
          EXCEPTION
174
               WHEN DATA_ERROR =>
175
                    NULL;
176
               WHEN OTHERS =>
177
                    FAILED ("WRONG EXCEPTION RAISED - 4");
178
          END;
179
 
180
          GET (FT, ST);                 -- TE
181
 
182
          GET (FT, CRAYON);                  -- RED
183
          IF CRAYON /= RED THEN
184
               FAILED ("READING NOT CONTINUED CORRECTLY AFTER" &
185
                       "DATA_ERROR EXCEPTION");
186
          END IF;
187
 
188
          BEGIN
189
               DELETE (FT);
190
          EXCEPTION
191
               WHEN USE_ERROR =>
192
                    NULL;
193
          END;
194
 
195
     EXCEPTION
196
          WHEN INCOMPLETE =>
197
               NULL;
198
     END;
199
 
200
     RESULT;
201
 
202
END CE3905C;

powered by: WebSVN 2.1.0

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