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/] [cc/] [cc1227a.ada] - Blame information for rev 309

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

Line No. Rev Author Line
1 294 jeremybenn
-- CC1227A.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, WHEN DERIVING FROM A FORMAL TYPE, THAT ALL THE PREDEFINED
27
--     OPERATIONS ASSOCIATED WITH THE CLASS OF THE FORMAL TYPE ARE
28
--     DECLARED FOR THE DERIVED TYPE.
29
 
30
-- HISTORY:
31
--     BCB 04/04/88  CREATED ORIGINAL TEST.
32
 
33
WITH REPORT; USE REPORT;
34
WITH SYSTEM; USE SYSTEM;
35
 
36
PROCEDURE CC1227A IS
37
 
38
     GENERIC
39
          TYPE FORM IS RANGE <>;
40
     PACKAGE P IS
41
          TYPE DER_FORM IS NEW FORM;
42
          FUNCTION IDENT_DER(X : DER_FORM) RETURN DER_FORM;
43
          FUNCTION IDENT_ADR(Y : ADDRESS) RETURN ADDRESS;
44
     END P;
45
 
46
     PACKAGE BODY P IS
47
          DER_VAR : DER_FORM;
48
          DER_FORM_BASE_FIRST : DER_FORM;
49
          DER_FORM_FIRST : DER_FORM;
50
          DER_FORM_LAST : DER_FORM;
51
          DER_FORM_SIZE : DER_FORM;
52
          DER_FORM_WIDTH : DER_FORM;
53
          DER_FORM_POS : DER_FORM;
54
          DER_FORM_VAL : DER_FORM;
55
          DER_FORM_SUCC : DER_FORM;
56
          DER_FORM_PRED : DER_FORM;
57
          DER_FORM_IMAGE : STRING(1..5);
58
          DER_FORM_VALUE : DER_FORM;
59
          DER_VAR_SIZE : DER_FORM;
60
          DER_VAR_ADDRESS : ADDRESS;
61
          DER_EQUAL, DER_UNEQUAL : DER_FORM;
62
          DER_GREATER : DER_FORM;
63
          DER_MOD, DER_REM : DER_FORM;
64
          DER_ABS, DER_EXP : DER_FORM;
65
          INT : INTEGER := 5;
66
          FUNCTION IDENT_DER(X : DER_FORM) RETURN DER_FORM IS
67
          BEGIN
68
               IF EQUAL(3,3) THEN
69
                    RETURN X;
70
               END IF;
71
               RETURN 0;
72
          END IDENT_DER;
73
          FUNCTION IDENT_ADR(Y : ADDRESS) RETURN ADDRESS IS
74
               X : DER_FORM;
75
          BEGIN
76
               IF EQUAL(3,3) THEN
77
                    RETURN Y;
78
               END IF;
79
               RETURN X'ADDRESS;
80
          END IDENT_ADR;
81
     BEGIN
82
          TEST ("CC1227A", "CHECK, WHEN DERIVING FROM A FORMAL TYPE, " &
83
                           "THAT ALL THE PREDEFINED OPERATIONS " &
84
                           "ASSOCIATED WITH THE CLASS OF THE FORMAL " &
85
                           "TYPE ARE DECLARED FOR THE DERIVED TYPE");
86
 
87
          DER_VAR := IDENT_DER(1);
88
 
89
          IF DER_VAR /= 1 THEN
90
               FAILED ("IMPROPER VALUE FROM ASSIGNMENT OPERATION");
91
          END IF;
92
 
93
          IF DER_VAR NOT IN DER_FORM THEN
94
               FAILED ("IMPROPER RESULT FROM MEMBERSHIP TEST");
95
          END IF;
96
 
97
          DER_VAR := DER_FORM'(2);
98
 
99
          IF DER_VAR /= IDENT_DER(2) THEN
100
               FAILED ("IMPROPER RESULT FROM QUALIFICATION");
101
          END IF;
102
 
103
          DER_VAR := DER_FORM(INT);
104
 
105
          IF DER_VAR /= IDENT_DER(5) THEN
106
               FAILED ("IMPROPER RESULT FROM EXPLICIT CONVERSION - " &
107
                       "INTEGER");
108
          END IF;
109
 
110
          DER_VAR := DER_FORM(3.0);
111
 
112
          IF DER_VAR /= IDENT_DER(3) THEN
113
               FAILED ("IMPROPER RESULT FROM EXPLICIT CONVERSION - " &
114
                        "FLOAT");
115
          END IF;
116
 
117
          DER_VAR := 1_000;
118
 
119
          IF DER_VAR /= IDENT_DER(1000) THEN
120
               FAILED ("IMPROPER RESULT FROM IMPLICIT CONVERSION");
121
          END IF;
122
 
123
          DER_FORM_BASE_FIRST := DER_FORM'BASE'FIRST;
124
 
125
          DER_FORM_FIRST := DER_FORM'FIRST;
126
 
127
          IF DER_FORM_BASE_FIRST /= IDENT_DER(DER_FORM_FIRST) THEN
128
               FAILED ("IMPROPER VALUE FOR DER_FORM'BASE'FIRST");
129
          END IF;
130
 
131
          IF DER_FORM_FIRST /= IDENT_DER(DER_FORM'FIRST) THEN
132
               FAILED ("IMPROPER VALUE FOR DER_FORM'FIRST");
133
          END IF;
134
 
135
          DER_FORM_LAST := DER_FORM'LAST;
136
 
137
          IF DER_FORM_LAST /= IDENT_DER(DER_FORM'LAST) THEN
138
               FAILED ("IMPROPER VALUE FOR DER_FORM'LAST");
139
          END IF;
140
 
141
          DER_FORM_SIZE := DER_FORM(DER_FORM'SIZE);
142
 
143
          IF DER_FORM_SIZE /= IDENT_DER(DER_FORM(DER_FORM'SIZE)) THEN
144
               FAILED ("IMPROPER VALUE FOR DER_FORM'SIZE");
145
          END IF;
146
 
147
          DER_FORM_WIDTH := DER_FORM(DER_FORM'WIDTH);
148
 
149
          IF DER_FORM_WIDTH /= IDENT_DER(DER_FORM(DER_FORM'WIDTH)) THEN
150
               FAILED ("IMPROPER VALUE FOR DER_FORM'WIDTH");
151
          END IF;
152
 
153
          DER_FORM_POS := DER_FORM(DER_FORM'POS(DER_VAR));
154
 
155
          IF DER_FORM_POS /= IDENT_DER(DER_FORM(DER_FORM'POS(DER_VAR)))
156
               THEN FAILED ("IMPROPER VALUE FOR DER_FORM'POS(DER_VAR)");
157
          END IF;
158
 
159
          DER_FORM_VAL := DER_FORM'VAL(DER_VAR);
160
 
161
          IF DER_FORM_VAL /= IDENT_DER(DER_FORM'VAL(DER_VAR)) THEN
162
               FAILED ("IMPROPER VALUE FOR DER_FORM'VAL(DER_VAR)");
163
          END IF;
164
 
165
          DER_FORM_SUCC := DER_FORM'SUCC(DER_VAR);
166
 
167
          IF DER_FORM_SUCC /= IDENT_DER(DER_FORM'SUCC(DER_VAR)) THEN
168
               FAILED ("IMPROPER VALUE FOR DER_FORM'SUCC(DER_VAR)");
169
          END IF;
170
 
171
          DER_FORM_PRED := DER_FORM'PRED(DER_VAR);
172
 
173
          IF DER_FORM_PRED /= IDENT_DER(DER_FORM'PRED(DER_VAR)) THEN
174
               FAILED ("IMPROPER VALUE FOR DER_FORM'PRED(DER_VAR)");
175
          END IF;
176
 
177
          DER_FORM_IMAGE := DER_FORM'IMAGE(DER_VAR);
178
 
179
          IF DER_FORM_IMAGE(2..5) /= "1000" THEN
180
               FAILED ("IMPROPER VALUE FOR DER_FORM'IMAGE(DER_VAR)");
181
          END IF;
182
 
183
          DER_FORM_VALUE := DER_FORM'VALUE(DER_FORM_IMAGE);
184
 
185
          IF DER_FORM_VALUE /= IDENT_DER(1000) THEN
186
               FAILED ("IMPROPER VALUE FOR DER_FORM'VALUE" &
187
                       "(DER_FORM_IMAGE)");
188
          END IF;
189
 
190
          DER_VAR_SIZE := DER_FORM(DER_VAR'SIZE);
191
 
192
          IF DER_VAR_SIZE /= IDENT_DER(DER_FORM(DER_VAR'SIZE)) THEN
193
               FAILED ("IMPROPER VALUE FOR DER_VAR'SIZE");
194
          END IF;
195
 
196
          DER_VAR_ADDRESS := DER_VAR'ADDRESS;
197
 
198
          IF DER_VAR_ADDRESS /= IDENT_ADR(DER_VAR'ADDRESS) THEN
199
               FAILED ("IMPROPER VALUE FOR DER_VAR'ADDRESS");
200
          END IF;
201
 
202
          DER_EQUAL := IDENT_DER(1000);
203
 
204
          IF DER_VAR /= DER_EQUAL THEN
205
               FAILED ("IMPROPER RESULT FROM INEQUALITY OPERATOR");
206
          END IF;
207
 
208
          DER_UNEQUAL := IDENT_DER(500);
209
 
210
          IF DER_VAR = DER_UNEQUAL THEN
211
               FAILED ("IMPROPER RESULT FROM EQUALITY OPERATOR");
212
          END IF;
213
 
214
          IF DER_VAR < DER_UNEQUAL THEN
215
               FAILED ("IMPROPER RESULT FROM LESS THAN OPERATOR");
216
          END IF;
217
 
218
          IF DER_VAR <= DER_UNEQUAL THEN
219
               FAILED ("IMPROPER RESULT FROM LESS THAN OR EQUAL TO " &
220
                       "OPERATOR");
221
          END IF;
222
 
223
          DER_GREATER := IDENT_DER(1500);
224
 
225
          IF DER_VAR > DER_GREATER THEN
226
               FAILED ("IMPROPER RESULT FROM GREATER THAN OPERATOR");
227
          END IF;
228
 
229
          IF DER_VAR >= DER_GREATER THEN
230
               FAILED ("IMPROPER RESULT FROM GREATER THAN OR EQUAL " &
231
                       "TO OPERATOR");
232
          END IF;
233
 
234
          DER_VAR := DER_VAR + DER_EQUAL;
235
 
236
          IF DER_VAR /= IDENT_DER(2000) THEN
237
               FAILED ("IMPROPER RESULT FROM ADDITION OPERATOR");
238
          END IF;
239
 
240
          DER_VAR := DER_VAR - DER_EQUAL;
241
 
242
          IF DER_VAR /= IDENT_DER(1000) THEN
243
               FAILED ("IMPROPER RESULT FROM SUBTRACTION OPERATOR");
244
          END IF;
245
 
246
          DER_VAR := DER_VAR * IDENT_DER(2);
247
 
248
          IF DER_VAR /= IDENT_DER(2000) THEN
249
               FAILED ("IMPROPER RESULT FROM MULTIPLICATION OPERATOR");
250
          END IF;
251
 
252
          DER_VAR := DER_VAR / IDENT_DER(2);
253
 
254
          IF DER_VAR /= IDENT_DER(1000) THEN
255
               FAILED ("IMPROPER RESULT FROM DIVISION OPERATOR");
256
          END IF;
257
 
258
          DER_MOD := DER_GREATER MOD DER_VAR;
259
 
260
          IF DER_MOD /= IDENT_DER(500) THEN
261
               FAILED ("IMPROPER RESULT FROM MOD OPERATOR");
262
          END IF;
263
 
264
          DER_REM := DER_GREATER REM DER_VAR;
265
 
266
          IF DER_REM /= IDENT_DER(500) THEN
267
               FAILED ("IMPROPER RESULT FROM REM OPERATOR");
268
          END IF;
269
 
270
          DER_ABS := ABS(IDENT_DER(-1500));
271
 
272
          IF DER_ABS /= IDENT_DER(DER_GREATER) THEN
273
               FAILED ("IMPROPER RESULT FROM ABS OPERATOR");
274
          END IF;
275
 
276
          DER_EXP := IDENT_DER(2) ** IDENT_INT(2);
277
 
278
          IF DER_EXP /= IDENT_DER(4) THEN
279
               FAILED ("IMPROPER RESULT FROM EXPONENTIATION OPERATOR");
280
          END IF;
281
 
282
          RESULT;
283
     END P;
284
 
285
     PACKAGE PACK IS NEW P(INTEGER);
286
 
287
BEGIN
288
     NULL;
289
END CC1227A;

powered by: WebSVN 2.1.0

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