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/] [c3/] [c34007d.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
-- C34007D.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 REQUIRED PREDEFINED OPERATIONS ARE DECLARED
27
--     (IMPLICITLY) FOR DERIVED ACCESS TYPES WHOSE DESIGNATED TYPE IS A
28
--     ONE-DIMENSIONAL ARRAY TYPE.  THIS TEST IS PART 1 OF 2 TESTS
29
--     WHICH COVER THE OBJECTIVE.  THE SECOND PART IS IN TEST C34007V.
30
 
31
-- HISTORY:
32
--     JRK 09/25/86  CREATED ORIGINAL TEST.
33
--     BCB 10/21/87  CHANGED HEADER TO STANDARD FORMAT.  REVISED TEST SO
34
--                   T'STORAGE_SIZE IS NOT REQUIRED TO BE > 1.
35
--     BCB 09/26/88  REMOVED COMPARISON INVOLVING OBJECT SIZE.
36
--     BCB 04/12/90  SPLIT ORIGINAL TEST INTO C34007D.ADA AND
37
--                   C34007V.ADA.  PUT CHECK FOR 'STORAGE_SIZE IN
38
--                   EXCEPTION HANDLER.
39
--     THS 09/18/90  REMOVED DECLARATION OF B, MADE THE BODY OF
40
--                   PROCEDURE A NULL, AND DELETED ALL REFERENCES TO B.
41
--     PWN 01/31/95  REMOVED INCONSISTENCIES WITH ADA 9X.
42
 
43
WITH SYSTEM; USE SYSTEM;
44
WITH REPORT; USE REPORT;
45
 
46
PROCEDURE C34007D IS
47
 
48
     SUBTYPE COMPONENT IS INTEGER;
49
 
50
     TYPE DESIGNATED IS ARRAY (NATURAL RANGE <>) OF COMPONENT;
51
 
52
     SUBTYPE SUBDESIGNATED IS DESIGNATED (IDENT_INT (5) ..
53
                                          IDENT_INT (7));
54
 
55
     PACKAGE PKG IS
56
 
57
          TYPE PARENT IS ACCESS DESIGNATED;
58
 
59
     END PKG;
60
 
61
     USE PKG;
62
 
63
     TYPE T IS NEW PARENT (IDENT_INT (5) .. IDENT_INT (7));
64
 
65
     X : T         := NEW SUBDESIGNATED'(OTHERS => 2);
66
     K : INTEGER   := X'SIZE;
67
     Y : T         := NEW SUBDESIGNATED'(1, 2, 3);
68
     W : PARENT    := NEW SUBDESIGNATED'(OTHERS => 2);
69
     C : COMPONENT := 1;
70
     N : CONSTANT  := 1;
71
 
72
     PROCEDURE A (X : ADDRESS) IS
73
     BEGIN
74
          NULL;
75
     END A;
76
 
77
     FUNCTION V RETURN T IS
78
     BEGIN
79
          RETURN NEW SUBDESIGNATED'(OTHERS => C);
80
     END V;
81
 
82
     FUNCTION IDENT (X : T) RETURN T IS
83
     BEGIN
84
          IF X = NULL OR ELSE
85
             EQUAL (X'LENGTH, X'LENGTH) THEN
86
               RETURN X;                          -- ALWAYS EXECUTED.
87
          END IF;
88
          RETURN NEW SUBDESIGNATED;
89
     END IDENT;
90
 
91
BEGIN
92
     TEST ("C34007D", "CHECK THAT THE REQUIRED PREDEFINED OPERATIONS " &
93
                      "ARE DECLARED (IMPLICITLY) FOR DERIVED " &
94
                      "ACCESS TYPES WHOSE DESIGNATED TYPE IS A " &
95
                      "ONE-DIMENSIONAL ARRAY TYPE.  THIS TEST IS " &
96
                      "PART 1 OF 2 TESTS WHICH COVER THE OBJECTIVE.  " &
97
                      "THE SECOND PART IS IN TEST C34007V");
98
 
99
     IF Y = NULL OR ELSE Y.ALL /= (1, 2, 3) THEN
100
          FAILED ("INCORRECT INITIALIZATION");
101
     END IF;
102
 
103
     X := IDENT (Y);
104
     IF X /= Y THEN
105
          FAILED ("INCORRECT :=");
106
     END IF;
107
 
108
     IF T'(X) /= Y THEN
109
          FAILED ("INCORRECT QUALIFICATION");
110
     END IF;
111
 
112
     IF T (X) /= Y THEN
113
          FAILED ("INCORRECT SELF CONVERSION");
114
     END IF;
115
 
116
     IF EQUAL (3, 3) THEN
117
          W := NEW SUBDESIGNATED'(1, 2, 3);
118
     END IF;
119
     X := T (W);
120
     IF X = NULL OR ELSE X = Y OR ELSE X.ALL /= (1, 2, 3) THEN
121
          FAILED ("INCORRECT CONVERSION FROM PARENT");
122
     END IF;
123
 
124
     X := IDENT (Y);
125
     W := PARENT (X);
126
     IF W = NULL OR ELSE W.ALL /= (1, 2, 3) OR ELSE T (W) /= Y THEN
127
          FAILED ("INCORRECT CONVERSION TO PARENT - 1");
128
     END IF;
129
 
130
     IF IDENT (NULL) /= NULL OR X = NULL THEN
131
          FAILED ("INCORRECT NULL");
132
     END IF;
133
 
134
     X := IDENT (NEW SUBDESIGNATED'(1, 2, 3));
135
     IF (X = NULL OR ELSE X = Y OR ELSE X.ALL /= (1, 2, 3)) OR
136
        X = NEW DESIGNATED'(1, 2) THEN
137
          FAILED ("INCORRECT ALLOCATOR");
138
     END IF;
139
 
140
     X := IDENT (NULL);
141
     BEGIN
142
          IF X.ALL = (0, 0, 0) THEN
143
               FAILED ("NO EXCEPTION FOR NULL.ALL - 1");
144
          ELSE FAILED ("NO EXCEPTION FOR NULL.ALL - 2");
145
          END IF;
146
     EXCEPTION
147
          WHEN CONSTRAINT_ERROR =>
148
               NULL;
149
          WHEN OTHERS =>
150
               FAILED ("WRONG EXCEPTION FOR NULL.ALL");
151
     END;
152
 
153
     X := IDENT (Y);
154
     X (IDENT_INT (7)) := 4;
155
     IF X /= Y OR Y.ALL /= (1, 2, 4) THEN
156
          FAILED ("INCORRECT INDEX (ASSIGNMENT)");
157
     END IF;
158
 
159
     Y.ALL := (1, 2, 3);
160
     X := IDENT (Y);
161
     X (IDENT_INT (5) .. IDENT_INT (6)) := (4, 5);
162
     IF X /= Y OR Y.ALL /= (4, 5, 3) THEN
163
          FAILED ("INCORRECT SLICE (ASSIGNMENT)");
164
     END IF;
165
 
166
     A (X'ADDRESS);
167
 
168
     IF X'FIRST /= 5 THEN
169
          FAILED ("INCORRECT OBJECT'FIRST");
170
     END IF;
171
 
172
     IF V'FIRST /= 5 THEN
173
          FAILED ("INCORRECT VALUE'FIRST");
174
     END IF;
175
 
176
     IF X'FIRST (N) /= 5 THEN
177
          FAILED ("INCORRECT OBJECT'FIRST (N)");
178
     END IF;
179
 
180
     IF V'FIRST (N) /= 5 THEN
181
          FAILED ("INCORRECT VALUE'FIRST (N)");
182
     END IF;
183
 
184
     IF X'LAST /= 7 THEN
185
          FAILED ("INCORRECT OBJECT'LAST");
186
     END IF;
187
 
188
     IF V'LAST /= 7 THEN
189
          FAILED ("INCORRECT VALUE'LAST");
190
     END IF;
191
 
192
     IF X'LAST (N) /= 7 THEN
193
          FAILED ("INCORRECT OBJECT'LAST (N)");
194
     END IF;
195
 
196
     IF V'LAST (N) /= 7 THEN
197
          FAILED ("INCORRECT VALUE'LAST (N)");
198
     END IF;
199
 
200
     IF X'LENGTH /= 3 THEN
201
          FAILED ("INCORRECT OBJECT'LENGTH");
202
     END IF;
203
 
204
     IF V'LENGTH /= 3 THEN
205
          FAILED ("INCORRECT VALUE'LENGTH");
206
     END IF;
207
 
208
     IF X'LENGTH (N) /= 3 THEN
209
          FAILED ("INCORRECT OBJECT'LENGTH (N)");
210
     END IF;
211
 
212
     IF V'LENGTH (N) /= 3 THEN
213
          FAILED ("INCORRECT VALUE'LENGTH (N)");
214
     END IF;
215
 
216
     DECLARE
217
          Y : DESIGNATED (X'RANGE);
218
     BEGIN
219
          IF Y'FIRST /= 5 OR Y'LAST /= 7 THEN
220
               FAILED ("INCORRECT OBJECT'RANGE");
221
          END IF;
222
     END;
223
 
224
     DECLARE
225
          Y : DESIGNATED (V'RANGE);
226
     BEGIN
227
          IF Y'FIRST /= 5 OR Y'LAST /= 7 THEN
228
               FAILED ("INCORRECT VALUE'RANGE");
229
          END IF;
230
     END;
231
 
232
     DECLARE
233
          Y : DESIGNATED (X'RANGE (N));
234
     BEGIN
235
          IF Y'FIRST /= 5 OR Y'LAST /= 7 THEN
236
               FAILED ("INCORRECT OBJECT'RANGE (N)");
237
          END IF;
238
     END;
239
 
240
     DECLARE
241
          Y : DESIGNATED (V'RANGE (N));
242
     BEGIN
243
          IF Y'FIRST /= 5 OR Y'LAST /= 7 THEN
244
               FAILED ("INCORRECT VALUE'RANGE (N)");
245
          END IF;
246
     END;
247
 
248
     IF T'SIZE < 1 THEN
249
          FAILED ("INCORRECT TYPE'SIZE");
250
     END IF;
251
 
252
     BEGIN
253
          IF T'STORAGE_SIZE /= PARENT'STORAGE_SIZE THEN
254
               FAILED ("COLLECTION SIZE OF DERIVED TYPE IS NOT " &
255
                       "EQUAL TO COLLECTION SIZE OF PARENT TYPE");
256
          END IF;
257
     EXCEPTION
258
          WHEN PROGRAM_ERROR =>
259
               COMMENT ("PROGRAM_ERROR RAISED FOR " &
260
                        "UNDEFINED STORAGE_SIZE (AI-00608)");
261
          WHEN OTHERS =>
262
               FAILED ("UNEXPECTED EXCEPTION RAISED");
263
     END;
264
 
265
     RESULT;
266
END C34007D;

powered by: WebSVN 2.1.0

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