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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- CE3704C.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 INTEGER_IO GET RAISES CONSTRAINT_ERROR IF THE
27
--     WIDTH PARAMETER IS NEGATIVE, IF THE WIDTH PARAMETER IS
28
--     GREATER THAN FIELD'LAST WHEN FIELD'LAST IS LESS THAN
29
--     INTEGER'LAST, OR THE VALUE READ IS OUT OF THE RANGE OF
30
--     THE ITEM PARAMETER BUT WITHIN THE RANGE OF INSTANTIATED
31
--     TYPE.
32
 
33
-- HISTORY:
34
--     SPS 10/04/82
35
--     DWC 09/09/87  ADDED CASES FOR WIDTH BEING GREATER THAN
36
--                   FIELD'LAST AND THE VALUE BEING READ IS OUT
37
--                   OF ITEM'S RANGE BUT WITHIN INSTANTIATED
38
--                   RANGE.
39
--     JRL 06/07/96  Added call to Ident_Int in expressions involving
40
--                   Field'Last, to make the expressions non-static and
41
--                   prevent compile-time rejection.
42
 
43
WITH REPORT; USE REPORT;
44
WITH TEXT_IO; USE TEXT_IO;
45
 
46
PROCEDURE CE3704C IS
47
     INCOMPLETE : EXCEPTION;
48
 
49
BEGIN
50
 
51
     TEST ("CE3704C", "CHECK THAT INTEGER_IO GET RAISES " &
52
                      "CONSTRAINT_ERROR IF THE WIDTH PARAMETER " &
53
                      "IS NEGATIVE, IF THE WIDTH PARAMETER IS " &
54
                      "GREATER THAN FIELD'LAST WHEN FIELD'LAST IS " &
55
                      "LESS THAN INTEGER'LAST, OR THE VALUE READ " &
56
                      "IS OUT OF THE RANGE OF THE ITEM PARAMETER " &
57
                      "BUT WITHIN THE RANGE OF INSTANTIATED TYPE");
58
 
59
     DECLARE
60
          FT : FILE_TYPE;
61
          TYPE INT IS NEW INTEGER RANGE 1 .. 10;
62
          PACKAGE IIO IS NEW INTEGER_IO (INT);
63
          X : INT RANGE 1 .. 5;
64
          USE IIO;
65
     BEGIN
66
 
67
          BEGIN
68
               GET (FT, X, IDENT_INT(-1));
69
               FAILED ("CONSTRAINT_ERROR NOT RAISED - FILE");
70
          EXCEPTION
71
               WHEN CONSTRAINT_ERROR =>
72
                    NULL;
73
               WHEN STATUS_ERROR =>
74
                    FAILED ("RAISED STATUS_ERROR");
75
               WHEN OTHERS =>
76
                    FAILED ("WRONG EXCEPTION RAISED - FILE");
77
          END;
78
 
79
          BEGIN
80
               GET (X, IDENT_INT(-6));
81
               FAILED ("CONSTRAINT_ERROR NOT RAISED - DEFAULT");
82
          EXCEPTION
83
               WHEN CONSTRAINT_ERROR =>
84
                    NULL;
85
               WHEN OTHERS =>
86
                    FAILED ("WRONG EXCEPTION RAISED - DEFAULT");
87
          END;
88
 
89
          BEGIN
90
               CREATE (FT, OUT_FILE, LEGAL_FILE_NAME);
91
          EXCEPTION
92
               WHEN USE_ERROR =>
93
                    NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " &
94
                                    "WITH OUT_FILE MODE");
95
                    RAISE INCOMPLETE;
96
               WHEN NAME_ERROR =>
97
                    NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " &
98
                                    "WITH OUT_FILE MODE");
99
                    RAISE INCOMPLETE;
100
          END;
101
 
102
          PUT (FT, 1);
103
          NEW_LINE (FT);
104
          PUT (FT, 8);
105
          NEW_LINE (FT);
106
          PUT (FT, 2);
107
 
108
          CLOSE (FT);
109
 
110
          BEGIN
111
               OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
112
          EXCEPTION
113
               WHEN USE_ERROR =>
114
                    NOT_APPLICABLE ("USE_ERROR FOR OPEN " &
115
                                    "WITH IN_FILE MODE");
116
                    RAISE INCOMPLETE;
117
          END;
118
 
119
          BEGIN
120
               GET (FT, X, IDENT_INT(-1));
121
               FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
122
                       "NEGATIVE WIDTH WITH EXTERNAL FILE");
123
          EXCEPTION
124
               WHEN CONSTRAINT_ERROR =>
125
                    NULL;
126
               WHEN OTHERS =>
127
                    FAILED ("WRONG EXCEPTION RAISED - " &
128
                            "NEGATIVE WIDTH WITH EXTERNAL FILE");
129
          END;
130
 
131
          SKIP_LINE (FT);
132
 
133
          BEGIN
134
               GET (FT, X);
135
               FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
136
                       "OUT OF RANGE");
137
          EXCEPTION
138
               WHEN CONSTRAINT_ERROR =>
139
                    NULL;
140
               WHEN OTHERS =>
141
                    FAILED ("WRONG EXCEPTION RAISED - " &
142
                            "OUT OF RANGE");
143
          END;
144
 
145
          SKIP_LINE (FT);
146
 
147
          IF FIELD'LAST < INTEGER'LAST THEN
148
               BEGIN
149
                    GET (FT, X, FIELD'LAST + Ident_Int(1));
150
                    FAILED ("CONSTRAINT_ERROR NOT RAISED - " &
151
                            "FIELD'LAST + 1 WIDTH WITH " &
152
                            "EXTERNAL FILE");
153
               EXCEPTION
154
                    WHEN CONSTRAINT_ERROR =>
155
                         NULL;
156
                    WHEN OTHERS =>
157
                         FAILED ("WRONG EXCEPTION RAISED - " &
158
                                 "FIELD'LAST + 1 WIDTH WITH " &
159
                                 "EXTERNAL FILE");
160
               END;
161
          END IF;
162
 
163
          BEGIN
164
               DELETE (FT);
165
          EXCEPTION
166
               WHEN USE_ERROR =>
167
                    NULL;
168
          END;
169
 
170
     EXCEPTION
171
          WHEN INCOMPLETE =>
172
               NULL;
173
     END;
174
 
175
     RESULT;
176
END CE3704C;

powered by: WebSVN 2.1.0

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