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

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

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

powered by: WebSVN 2.1.0

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