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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CE3706C.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 PUT RAISES CONSTRAINT_ERROR IF:
27
--        A) THE BASE IS OUTSIDE THE RANGE 2..16.
28
--        B) THE VALUE OF WIDTH IS NEGATIVE OR GREATER THAN FIELD'LAST,
29
--           WHEN FIELD'LAST < INTEGER'LAST.
30
--        C) THE VALUE OF ITEM IS OUTSIDE THE RANGE OF THE INSTANTIATED
31
--           TYPE.
32
 
33
-- HISTORY:
34
--     SPS 10/05/82
35
--     JBG 08/30/83
36
--     JLH 09/10/87  ADDED CASES FOR THE VALUE OF THE WIDTH BEING LESS
37
--                   THAN ZERO AND GREATER THAN FIELD'LAST AND CASES FOR
38
--                   THE VALUE OF ITEM OUTSIDE THE RANGE OF THE
39
--                   INSTANTIATED TYPE.
40
--     JRL 06/07/96  Added call to Ident_Int in expressions involving
41
--                   Field'Last, to make the expressions non-static and
42
--                   prevent compile-time rejection.
43
 
44
WITH REPORT; USE REPORT;
45
WITH TEXT_IO; USE TEXT_IO;
46
 
47
PROCEDURE CE3706C IS
48
BEGIN
49
 
50
     TEST ("CE3706C", "CHECK THAT INTEGER_IO PUT RAISES CONSTRAINT " &
51
                      "ERROR APPROPRIATELY");
52
 
53
     DECLARE
54
          FT : FILE_TYPE;
55
          TYPE INT IS NEW INTEGER RANGE 1 .. 10;
56
          PACKAGE IIO IS NEW INTEGER_IO (INT);
57
          USE IIO;
58
          ST : STRING (1 .. 10);
59
     BEGIN
60
 
61
          BEGIN
62
               PUT (FT, 2, 6, 1);
63
               FAILED ("CONSTRAINT_ERROR NOT RAISED - FILE - 1");
64
          EXCEPTION
65
               WHEN CONSTRAINT_ERROR =>
66
                    NULL;
67
               WHEN OTHERS =>
68
                    FAILED ("WRONG EXCEPTION RAISED - FILE - 1");
69
          END;
70
 
71
          BEGIN
72
               PUT (3, 4, 17);
73
               FAILED ("CONSTRAINT_ERROR NOT RAISED - DEFAULT - 1");
74
          EXCEPTION
75
               WHEN CONSTRAINT_ERROR =>
76
                    NULL;
77
               WHEN OTHERS =>
78
                    FAILED ("WRONG EXCEPTION RAISED - DEFAULT - 1");
79
          END;
80
 
81
          BEGIN
82
               PUT (TO => ST, ITEM => 4, BASE => -3);
83
               FAILED ("CONSTRAINT_ERROR NOT RAISED - STRING - 1");
84
          EXCEPTION
85
               WHEN CONSTRAINT_ERROR =>
86
                    NULL;
87
               WHEN OTHERS =>
88
                    FAILED ("WRONG EXCEPTION RAISED - STRING - 1");
89
          END;
90
 
91
          BEGIN
92
               PUT (ST, 5, 17);
93
               FAILED ("CONSTRAINT_ERROR NOT RAISED - STRING - 2");
94
          EXCEPTION
95
               WHEN CONSTRAINT_ERROR =>
96
                    NULL;
97
               WHEN OTHERS =>
98
                    FAILED ("WRONG EXCEPTION RAISED - STRING - 2");
99
          END;
100
 
101
          BEGIN
102
               PUT (FT, 5, -1);
103
               FAILED ("CONSTRAINT_ERROR NOT RAISED - FILE - 2");
104
          EXCEPTION
105
               WHEN CONSTRAINT_ERROR =>
106
                    NULL;
107
               WHEN OTHERS =>
108
                    FAILED ("WRONG EXCEPTION RAISED - FILE - 2");
109
          END;
110
 
111
          BEGIN
112
               PUT (7, -3);
113
               FAILED ("CONSTRAINT_ERROR NOT RAISED - DEFAULT - " &
114
                       "2");
115
          EXCEPTION
116
               WHEN CONSTRAINT_ERROR =>
117
                    NULL;
118
               WHEN OTHERS =>
119
                    FAILED ("WRONG EXCEPTION RAISED - DEFAULT - 2");
120
          END;
121
 
122
          IF FIELD'LAST < INTEGER'LAST THEN
123
               BEGIN
124
                    PUT (7, FIELD'LAST+Ident_Int(1));
125
                    FAILED ("CONSTRAINT_ERROR NOT RAISED FOR WIDTH " &
126
                            "GREATER THAN FIELD'LAST");
127
               EXCEPTION
128
                    WHEN CONSTRAINT_ERROR =>
129
                         NULL;
130
                    WHEN OTHERS =>
131
                         FAILED ("WRONG EXCEPTION RAISED FOR WIDTH " &
132
                                 "GREATER THAN FIELD'LAST");
133
               END;
134
 
135
          END IF;
136
 
137
          BEGIN
138
               PUT (FT, 11);
139
               FAILED ("CONSTRAINT_ERROR NOT RAISED FOR ITEM OUTSIDE " &
140
                       "RANGE - FILE");
141
          EXCEPTION
142
               WHEN CONSTRAINT_ERROR =>
143
                    NULL;
144
               WHEN OTHERS =>
145
                    FAILED ("WRONG EXCEPTION RAISED FOR ITEM OUTSIDE " &
146
                            "RANGE - FILE");
147
          END;
148
 
149
          BEGIN
150
               PUT (11);
151
               FAILED ("CONSTRAINT_ERROR NOT RAISED FOR ITEM OUTSIDE " &
152
                       "RANGE - DEFAULT");
153
          EXCEPTION
154
               WHEN CONSTRAINT_ERROR =>
155
                    NULL;
156
               WHEN OTHERS =>
157
                    FAILED ("WRONG EXCEPTION RAISED FOR ITEM OUTSIDE " &
158
                            "RANGE - DEFAULT");
159
          END;
160
 
161
     END;
162
 
163
     RESULT;
164
END CE3706C;

powered by: WebSVN 2.1.0

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