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/] [ce3804p.ada] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CE3804P.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 FIXED_IO GET RAISES CONSTRAINT_ERROR WHEN THE VALUE
27
--     SUPPLIED BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN FIELD'LAST
28
--     WHEN FIELD'LAST IS LESS THAN INTEGER'LAST, OR THE VALUE READ IS
29
--     OUT OF RANGE OF THE ITEM PARAMETER, BUT WITHIN THE RANGE OF THE
30
--     SUBTYPE USED TO INSTANTIATE FIXED_IO.
31
 
32
-- APPLICABILITY CRITERIA:
33
--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
34
--     TEXT FILES.
35
 
36
-- HISTORY:
37
--     DWC 09/15/87  CREATED ORIGINAL TEST.
38
--     JRL 06/07/96  Added call to Ident_Int in expressions involving
39
--                   Field'Last, to make the expressions non-static and
40
--                   prevent compile-time rejection. Corrected typo.
41
 
42
WITH REPORT;
43
USE REPORT;
44
WITH TEXT_IO;
45
USE TEXT_IO;
46
 
47
PROCEDURE CE3804P IS
48
     INCOMPLETE : EXCEPTION;
49
 
50
BEGIN
51
 
52
     TEST ("CE3804P", "CHECK THAT FLOAT_IO GET RAISES " &
53
                      "CONSTRAINT_ERROR WHEN THE VALUE SUPPLIED " &
54
                      "BY WIDTH IS NEGATIVE, WIDTH IS GREATER THAN " &
55
                      "FIELD'LAST WHEN FIELD'LAST IS LESS THAN " &
56
                      "INTEGER'LAST, OR THE VALUE READ IS OUT OF " &
57
                      "RANGE OF THE ITEM PARAMETER, BUT WITHIN THE " &
58
                      "RANGE OF THE SUBTYPE USED TO INSTANTIATE " &
59
                      "FLOAT_IO.");
60
 
61
     DECLARE
62
          TYPE FIXED IS DELTA 0.25 RANGE 0.0 .. 10.0;
63
          FT : FILE_TYPE;
64
          PACKAGE FX_IO IS NEW FIXED_IO (FIXED);
65
          USE FX_IO;
66
          X : FIXED RANGE 0.0 .. 5.0;
67
 
68
     BEGIN
69
          BEGIN
70
               GET (FT, X, IDENT_INT(-3));
71
               FAILED ("CONSTRAINT_ERROR NOT RAISED FOR NEGATIVE " &
72
                       "WIDTH");
73
          EXCEPTION
74
               WHEN CONSTRAINT_ERROR =>
75
                    NULL;
76
               WHEN STATUS_ERROR =>
77
                    FAILED ("STATUS_ERROR RAISED INSTEAD OF " &
78
                            "CONSTRAINT_ERROR FOR NEGATIVE WIDTH");
79
               WHEN OTHERS =>
80
                    FAILED ("WRONG EXCEPTION RAISED FOR NEGATIVE " &
81
                            "WIDTH");
82
          END;
83
 
84
          IF FIELD'LAST < INTEGER'LAST THEN
85
               BEGIN
86
                    GET (X, FIELD'LAST + Ident_Int(1));
87
                    FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
88
                            "FIELD'LAST + 1 WIDTH - DEFAULT");
89
               EXCEPTION
90
                    WHEN CONSTRAINT_ERROR =>
91
                         NULL;
92
                    WHEN OTHERS =>
93
                         FAILED ("WRONG EXCEPTION RAISED - " &
94
                                 "FIELD'LAST + 1 WIDTH - DEFAULT");
95
               END;
96
          END IF;
97
 
98
          BEGIN
99
               CREATE (FT, OUT_FILE, LEGAL_FILE_NAME);
100
          EXCEPTION
101
               WHEN USE_ERROR =>
102
                    NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " &
103
                                    "WITH OUT_FILE MODE");
104
                    RAISE INCOMPLETE;
105
               WHEN NAME_ERROR =>
106
                    NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " &
107
                                    "WITH OUT_FILE MODE");
108
                    RAISE INCOMPLETE;
109
          END;
110
 
111
          PUT (FT, "1.0");
112
          NEW_LINE (FT);
113
          PUT (FT, "8.0");
114
          NEW_LINE (FT);
115
          PUT (FT, "2.0");
116
          NEW_LINE (FT);
117
          PUT (FT, "3.0");
118
 
119
          CLOSE (FT);
120
 
121
          BEGIN
122
               OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
123
          EXCEPTION
124
               WHEN USE_ERROR =>
125
                    NOT_APPLICABLE ("USE_ERROR RAISED; TEXT OPEN " &
126
                                    "WITH IN_FILE MODE");
127
                    RAISE INCOMPLETE;
128
          END;
129
 
130
          GET (FT, X);
131
          IF X /= 1.0 THEN
132
               FAILED ("WRONG VALUE READ WITH EXTERNAL FILE");
133
          END IF;
134
 
135
          SKIP_LINE (FT);
136
 
137
          BEGIN
138
               GET (FT, X, 3);
139
               FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
140
                       "OUT OF RANGE");
141
          EXCEPTION
142
               WHEN CONSTRAINT_ERROR =>
143
                    NULL;
144
               WHEN OTHERS =>
145
                    FAILED ("WRONG EXCEPTION RAISED - " &
146
                            "OUT OF RANGE");
147
          END;
148
 
149
          SKIP_LINE (FT);
150
 
151
          BEGIN
152
               GET (FT, X, IDENT_INT(-1));
153
               FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
154
                       "NEGATIVE WIDTH WITH EXTERNAL FILE");
155
          EXCEPTION
156
               WHEN CONSTRAINT_ERROR =>
157
                    NULL;
158
               WHEN OTHERS =>
159
                    FAILED ("WRONG EXCEPTION RAISED - " &
160
                            "NEGATIVE WIDTH WITH EXTERNAL FILE");
161
          END;
162
 
163
          IF FIELD'LAST < INTEGER'LAST THEN
164
               BEGIN
165
                    GET (FT, X, FIELD'LAST + Ident_Int(1));
166
                    FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
167
                            "FIELD'LAST + 1 WIDTH WITH " &
168
                            "EXTERNAL FILE");
169
               EXCEPTION
170
                    WHEN CONSTRAINT_ERROR =>
171
                         NULL;
172
                    WHEN OTHERS =>
173
                         FAILED ("WRONG EXCEPTION RAISED - " &
174
                                 "FIELD'LAST + 1 WIDTH WITH " &
175
                                 "EXTERNAL FILE");
176
               END;
177
          END IF;
178
 
179
          SKIP_LINE (FT);
180
 
181
          BEGIN
182
               GET (FT, X, 3);
183
          EXCEPTION
184
               WHEN CONSTRAINT_ERROR =>
185
                    FAILED ("CONSTRAINT_ERROR RAISED; VALID WIDTH " &
186
                            "WITH EXTERNAL FILE");
187
               WHEN OTHERS =>
188
                    FAILED ("UNEXPECTED ERROR RAISED; VALID WIDTH " &
189
                            "WITH EXTERNAL FILE");
190
          END;
191
 
192
          BEGIN
193
               DELETE (FT);
194
          EXCEPTION
195
               WHEN USE_ERROR =>
196
                    NULL;
197
          END;
198
 
199
     EXCEPTION
200
          WHEN INCOMPLETE =>
201
               NULL;
202
     END;
203
 
204
     RESULT;
205
 
206
END CE3804P;

powered by: WebSVN 2.1.0

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