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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C96004A.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 THE PRE-DEFINED SUBTYPES FROM THE PACKAGE CALENDAR,
27
--     NAMELY YEAR_NUMBER, MONTH_NUMBER, DAY_NUMBER, AND DAY_DURATION,
28
--     HAVE THE CORRECT RANGE CONSTRAINTS. SUBTESTS ARE:
29
--       (A) YEAR_NUMBER.
30
--       (B) MONTH_NUMBER.
31
--       (C) DAY_NUMBER.
32
--       (D) DAY_DURATION.
33
 
34
-- HISTORY:
35
--     CPP 08/15/84  CREATED ORIGINAL TEST.
36
--     JET 01/06/88  UPDATED HEADER FORMAT AND ADDED CODE TO PREVENT
37
--                   OPTIMIZATION.
38
 
39
WITH CALENDAR;  USE CALENDAR;
40
WITH REPORT;  USE REPORT;
41
PROCEDURE C96004A IS
42
 
43
BEGIN
44
     TEST("C96004A", "CHECK THAT PRE-DEFINED SUBTYPES FROM THE " &
45
          "CALENDAR PACKAGE HAVE CORRECT RANGE CONSTRAINTS");
46
 
47
     ---------------------------------------------
48
 
49
     DECLARE   -- (A)
50
 
51
          YR : YEAR_NUMBER;
52
 
53
     BEGIN     -- (A)
54
 
55
          BEGIN
56
               YR := 1900;
57
               FAILED ("EXCEPTION NOT RAISED - (A)1");
58
               IF NOT EQUAL (YR, YR) THEN
59
                    COMMENT ("NO EXCEPTION RAISED");
60
               END IF;
61
 
62
          EXCEPTION
63
               WHEN CONSTRAINT_ERROR =>
64
                    NULL;
65
               WHEN OTHERS =>
66
                    FAILED ("WRONG EXCEPTION RAISED - (A)1");
67
          END;
68
 
69
          BEGIN
70
               YR := 84;
71
               FAILED ("EXCEPTION NOT RAISED - (A)2");
72
               IF NOT EQUAL (YR, YR) THEN
73
                    COMMENT ("NO EXCEPTION RAISED");
74
               END IF;
75
 
76
          EXCEPTION
77
               WHEN CONSTRAINT_ERROR =>
78
                    NULL;
79
               WHEN OTHERS =>
80
                    FAILED ("WRONG EXCEPTION RAISED - (A)2");
81
          END;
82
 
83
          BEGIN
84
               YR := 2099;
85
               IF NOT EQUAL (YR, YR) THEN
86
                    COMMENT ("NO EXCEPTION RAISED");
87
               END IF;
88
 
89
          EXCEPTION
90
               WHEN OTHERS =>
91
                    FAILED ("OK CASE RAISED EXCEPTION ON 2099 - (A)");
92
          END;
93
 
94
          BEGIN
95
               YR := IDENT_INT(2100);
96
               FAILED ("EXCEPTION NOT RAISED - (A)3");
97
               IF NOT EQUAL (YR, YR) THEN
98
                    COMMENT ("NO EXCEPTION RAISED");
99
               END IF;
100
 
101
          EXCEPTION
102
               WHEN CONSTRAINT_ERROR =>
103
                    NULL;
104
               WHEN OTHERS =>
105
                    FAILED ("WRONG EXCEPTION RAISED - (A)3");
106
          END;
107
 
108
     END; -- (A)
109
 
110
     ---------------------------------------------
111
 
112
     DECLARE   -- (B)
113
 
114
          MO : MONTH_NUMBER;
115
 
116
     BEGIN     -- (B)
117
 
118
          BEGIN
119
               MO := IDENT_INT(0);
120
               FAILED ("EXCEPTION NOT RAISED - (B)1");
121
               IF NOT EQUAL (MO, MO) THEN
122
                    COMMENT ("NO EXCEPTION RAISED");
123
               END IF;
124
 
125
          EXCEPTION
126
               WHEN CONSTRAINT_ERROR =>
127
                    NULL;
128
               WHEN OTHERS =>
129
                    FAILED ("WRONG EXCEPTION RAISED - (B)1");
130
          END;
131
 
132
          BEGIN
133
               MO := 12;
134
               IF NOT EQUAL (MO, MO) THEN
135
                    COMMENT ("NO EXCEPTION RAISED");
136
               END IF;
137
 
138
          EXCEPTION
139
               WHEN OTHERS =>
140
                    FAILED ("OK CASE RAISED EXCEPTION ON 12 - (B)");
141
          END;
142
 
143
          BEGIN
144
               MO := 13;
145
               FAILED ("EXCEPTION NOT RAISED - (B)2");
146
               IF NOT EQUAL (MO, MO) THEN
147
                    COMMENT ("NO EXCEPTION RAISED");
148
               END IF;
149
 
150
          EXCEPTION
151
               WHEN CONSTRAINT_ERROR =>
152
                    NULL;
153
               WHEN OTHERS =>
154
                    FAILED ("WRONG EXCEPTION RAISED - (B)2");
155
          END;
156
 
157
     END; -- (B)
158
 
159
     ---------------------------------------------
160
 
161
     DECLARE   -- (C)
162
 
163
          DY : DAY_NUMBER;
164
 
165
     BEGIN     -- (C)
166
 
167
          BEGIN
168
               DY := 0;
169
               FAILED ("EXCEPTION NOT RAISED - (C)1");
170
               IF NOT EQUAL (DY, DY) THEN
171
                    COMMENT ("NO EXCEPTION RAISED");
172
               END IF;
173
 
174
          EXCEPTION
175
               WHEN CONSTRAINT_ERROR =>
176
                    NULL;
177
               WHEN OTHERS =>
178
                    FAILED ("WRONG EXCEPTION RAISED - (C)1");
179
          END;
180
 
181
          BEGIN
182
               DY := IDENT_INT(32);
183
               FAILED ("EXCEPTION NOT RAISED - (C)2");
184
               IF NOT EQUAL (DY, DY) THEN
185
                    COMMENT ("NO EXCEPTION RAISED");
186
               END IF;
187
 
188
          EXCEPTION
189
               WHEN CONSTRAINT_ERROR =>
190
                    NULL;
191
               WHEN OTHERS =>
192
                    FAILED ("WRONG EXCEPTION RAISED - (C)2");
193
          END;
194
 
195
     END; -- (C)
196
 
197
     ---------------------------------------------
198
 
199
     DECLARE   -- (D)
200
 
201
          SEGMENT : DAY_DURATION;
202
 
203
          FUNCTION CHECK_OK (X : DAY_DURATION) RETURN BOOLEAN IS
204
               I : INTEGER := INTEGER (X);
205
          BEGIN
206
               RETURN EQUAL (I,I);
207
          END CHECK_OK;
208
 
209
     BEGIN     -- (D)
210
 
211
          BEGIN
212
               SEGMENT := 86_400.0;
213
               IF CHECK_OK (SEGMENT - 86_000.0) THEN
214
                    COMMENT ("NO EXCEPTION RAISED (D1)");
215
               ELSE
216
                    COMMENT ("NO EXCEPTION RAISED (D2)");
217
               END IF;
218
 
219
          EXCEPTION
220
               WHEN OTHERS =>
221
                    FAILED ("OK CASE RAISED EXCEPTION ON 86_400 - (D)");
222
          END;
223
 
224
          BEGIN
225
               SEGMENT := -4.0;
226
               FAILED ("EXCEPTION NOT RAISED - (D)1");
227
               IF NOT EQUAL (INTEGER(SEGMENT), INTEGER(SEGMENT)) THEN
228
                    COMMENT ("NO EXCEPTION RAISED (D3)");
229
               END IF;
230
 
231
          EXCEPTION
232
               WHEN CONSTRAINT_ERROR =>
233
                    NULL;
234
               WHEN OTHERS =>
235
                    FAILED ("WRONG EXCEPTION RAISED - (D)1");
236
          END;
237
 
238
          BEGIN
239
               SEGMENT := 86_401.00;
240
               IF CHECK_OK (SEGMENT - 86_000.0) THEN
241
                    FAILED ("NO EXCEPTION RAISED (D4)");
242
               ELSE
243
                    FAILED ("NO EXCEPTION RAISED (D5)");
244
               END IF;
245
 
246
          EXCEPTION
247
               WHEN CONSTRAINT_ERROR =>
248
                    NULL;
249
               WHEN OTHERS =>
250
                    FAILED ("WRONG EXCEPTION RAISED - (D)2");
251
          END;
252
 
253
     END; -- (D)
254
 
255
     ---------------------------------------------
256
 
257
     RESULT;
258
END C96004A;

powered by: WebSVN 2.1.0

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