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/] [c5/] [c52005a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C52005A.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
-- CHECK THAT THE CONSTRAINT_ERROR EXCEPTION IS RAISED WHEN A STATIC
26
--    EXPRESSION VALUE IS OUTSIDE THE STATIC RANGE OF INTEGER, BOOLEAN,
27
--    CHARACTER, AND ENUMERATION ASSIGNMENT TARGET VARIABLES.
28
 
29
-- DCB 2/5/80
30
-- JRK 7/21/80
31
-- SPS 3/21/83
32
 
33
WITH REPORT;
34
PROCEDURE C52005A IS
35
 
36
     USE REPORT;
37
 
38
BEGIN
39
     TEST ("C52005A", "CHECK THAT CONSTRAINT_ERROR EXCEPTION IS RAISED "
40
         & "ON STATIC OUT OF RANGE INTEGER, BOOLEAN, CHARACTER, " &
41
           "AND ENUMERATION ASSIGNMENTS");
42
 
43
-------------------------
44
 
45
     DECLARE
46
          I1 : INTEGER RANGE 0..10 := 5;
47
 
48
     BEGIN
49
          I1 := 11;
50
 
51
          FAILED ("EXCEPTION NOT RAISED FOR OUT OF RANGE INT ASSNMT");
52
 
53
     EXCEPTION
54
     WHEN CONSTRAINT_ERROR =>
55
          IF I1 /= 5 THEN
56
               FAILED ("VALUE ALTERED BEFORE INT RANGE" &
57
                       "EXCEPTION");
58
          END IF;
59
 
60
     END;
61
 
62
-------------------------
63
 
64
     DECLARE
65
          I2 : INTEGER RANGE 0..10 := 5;
66
 
67
     BEGIN
68
          I2 := 10;
69
 
70
     EXCEPTION
71
     WHEN CONSTRAINT_ERROR =>
72
          FAILED ("EXCEPTION RAISED ON LEGAL INTEGER ASSIGNMENT");
73
     END;
74
 
75
-------------------------
76
 
77
     DECLARE
78
          B1 : BOOLEAN RANGE TRUE..TRUE := TRUE;
79
 
80
     BEGIN
81
          B1 := FALSE;
82
 
83
          FAILED ("EXCEPTION NOT RAISED FOR OUT OF RANGE BOOL ASSNMT");
84
 
85
     EXCEPTION
86
     WHEN CONSTRAINT_ERROR =>
87
          IF B1 /= TRUE THEN
88
               FAILED ("VALUE ALTERED BEFORE BOOLEAN RANGE EXCEPTION");
89
          END IF;
90
     END;
91
 
92
-------------------------
93
 
94
     DECLARE
95
          B2 : BOOLEAN := TRUE;
96
 
97
     BEGIN
98
          B2 := FALSE;
99
 
100
     EXCEPTION
101
     WHEN CONSTRAINT_ERROR =>
102
          FAILED ("EXCEPTION RAISED ON LEGAL BOOLEAN ASSNMNT");
103
 
104
     END;
105
 
106
-------------------------
107
 
108
     DECLARE
109
          C1 : CHARACTER RANGE 'B'..'Z' := 'M';
110
 
111
     BEGIN
112
          C1 := 'A';
113
 
114
          FAILED ("EXCEPTION NOT RAISED FOR OUT OF RANGE CHAR ASSNMNT");
115
 
116
     EXCEPTION
117
     WHEN CONSTRAINT_ERROR =>
118
          IF C1 /= 'M' THEN
119
               FAILED ("VALUE ALTERED BEFORE CHARACTER RANGE " &
120
                       "EXCEPTION");
121
          END IF;
122
 
123
     END;
124
 
125
-------------------------
126
 
127
     DECLARE
128
          C2 : CHARACTER RANGE 'B'..'Z' := 'M';
129
 
130
     BEGIN
131
          C2 := 'B';
132
 
133
     EXCEPTION
134
     WHEN CONSTRAINT_ERROR =>
135
          FAILED ("EXCEPTION RAISED OF LEGAL CHARACTER ASSNMNT");
136
 
137
     END;
138
 
139
-------------------------
140
 
141
     DECLARE
142
          TYPE DAY IS (SUN, MON, TUE, WED, THU, FRI, SAT);
143
          WORKDAY : DAY RANGE MON..FRI := TUE;
144
 
145
     BEGIN
146
          WORKDAY := SUN;
147
 
148
          FAILED ("EXCEPTION NOT RAISED FOR OUT OF RANGE ENUM. " &
149
                  "ASSIGNMENT");
150
 
151
     EXCEPTION
152
     WHEN CONSTRAINT_ERROR =>
153
          IF WORKDAY /= TUE THEN
154
               FAILED ("VALUE ALTERED BEFORE ENUM. RANGE EXCEPTION");
155
          END IF;
156
 
157
     END;
158
 
159
-------------------------
160
 
161
     DECLARE
162
          TYPE DAY IS (SUN, MON, TUE, WED, THU, FRI, SAT);
163
          WORKDAY : DAY RANGE MON..FRI := TUE;
164
 
165
     BEGIN
166
          WORKDAY := FRI;
167
 
168
     EXCEPTION
169
     WHEN CONSTRAINT_ERROR =>
170
          FAILED ("EXCEPTION RAISED ON LEGAL ENUM. ASSNMNT");
171
 
172
     END;
173
 
174
-------------------------
175
 
176
     RESULT;
177
END C52005A;

powered by: WebSVN 2.1.0

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