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/] [c4/] [c41103a.ada] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
-- C41103A.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 NAME IN AN INDEXED_COMPONENT MAY BE:
26
--   AN IDENTIFIER DENOTING AN ARRAY OBJECT - N1;
27
--   AN IDENTIFIER DENOTING AN ACCESS OBJECT WHOSE VALUE
28
--        DESIGNATES AN ARRAY OBJECT - N2;
29
--   A FUNCTION CALL DELIVERING AN ARRAY OBJECT USING
30
--        A PREDEFINED FUNCTION - &,
31
--        A USER-DEFINED FUNCTION - F1;
32
--   A FUNCTION CALL DELIVERING AN ACCESS VALUE THAT
33
--        DESIGNATES AN ARRAY - F2;
34
--   A SLICE (CHECKING UPPER AND LOWER BOUND COMPONENTS) - N3;
35
--   AN INDEXED COMPONENT DENOTING AN ARRAY OBJECT
36
--        (ARRAY OF ARRAYS) - N4;
37
--   AN IDENTIFIER PREFIXED BY THE NAME OF THE INNERMOST UNIT
38
--        ENCLOSING ITS DECLARATION - C41103A.N1;
39
--   A RECORD COMPONENT (OF A RECORD CONTAINING ONE OR MORE
40
--        ARRAYS WHOSE BOUNDS DEPEND ON A DISCRIMINANT) - N5.
41
-- CHECK THAT THE APPROPRIATE COMPONENT IS ACCESSED (FOR
42
--   STATIC INDICES).
43
 
44
-- WKB 7/27/81
45
-- JRK 7/28/81
46
-- SPS 10/26/82
47
-- PWN 11/30/94 SUBTYPE QUALIFIED LITERALS FOR ADA 9X.
48
 
49
WITH REPORT;
50
USE REPORT;
51
PROCEDURE C41103A IS
52
 
53
     TYPE A1 IS ARRAY (INTEGER RANGE 1..4) OF INTEGER;
54
     N1 : A1 := (1,2,3,4);
55
 
56
BEGIN
57
     TEST ("C41103A", "CHECK THAT AN INDEXED_COMPONENT MAY BE OF " &
58
                      "CERTAIN FORMS AND THAT THE APPROPRIATE " &
59
                      "COMPONENT IS ACCESSED (FOR STATIC INDICES)");
60
 
61
     DECLARE
62
 
63
          TYPE A2 IS ARRAY (INTEGER RANGE 1..4) OF BOOLEAN;
64
          TYPE A3 IS ACCESS A1;
65
          TYPE A4 IS ARRAY (INTEGER RANGE 1..4) OF A1;
66
          TYPE R (LENGTH : INTEGER) IS
67
               RECORD
68
                    S : STRING (1..LENGTH);
69
               END RECORD;
70
 
71
          N2 : A3 := NEW A1' (1,2,3,4);
72
          N3 : ARRAY (1..7) OF INTEGER := (1,2,3,4,5,6,7);
73
          N4 : A4 := (1 => (1,2,3,4), 2 => (5,6,7,8),
74
                      3 => (9,10,11,12), 4 => (13,14,15,16));
75
          N5 : R(4) := (LENGTH => 4, S => "ABCD");
76
 
77
          FUNCTION F1 RETURN A2 IS
78
          BEGIN
79
               RETURN (FALSE,FALSE,TRUE,FALSE);
80
          END F1;
81
 
82
          FUNCTION F2 RETURN A3 IS
83
          BEGIN
84
               RETURN N2;
85
          END F2;
86
 
87
          PROCEDURE P1 (X : IN INTEGER; Y : IN OUT INTEGER;
88
                        Z : OUT INTEGER; W : IN STRING) IS
89
          BEGIN
90
               IF X /= 2 THEN
91
                    FAILED ("WRONG VALUE FOR IN PARAMETER - " & W);
92
               END IF;
93
               IF Y /= 3 THEN
94
                    FAILED ("WRONG VALUE FOR IN OUT PARAMETER - " & W);
95
               END IF;
96
               Y := 8;
97
               Z := 9;
98
          END P1;
99
 
100
          PROCEDURE P2 (X : CHARACTER) IS
101
          BEGIN
102
               IF X /= 'C' THEN
103
                    FAILED ("WRONG VALUE FOR IN PARAMETER - '&'");
104
               END IF;
105
          END P2;
106
 
107
          PROCEDURE P3 (X : BOOLEAN) IS
108
          BEGIN
109
               IF X /= TRUE THEN
110
                    FAILED ("WRONG VALUE FOR IN PARAMETER - F1");
111
               END IF;
112
          END P3;
113
 
114
          PROCEDURE P5 (X : IN CHARACTER; Y : IN OUT CHARACTER;
115
                        Z : OUT CHARACTER) IS
116
          BEGIN
117
               IF X /= 'A' THEN
118
                    FAILED ("WRONG VALUE FOR IN PARAMETER - N5");
119
               END IF;
120
               IF Y /= 'D' THEN
121
                    FAILED ("WRONG VALUE FOR IN OUT PARAMETER - N5");
122
               END IF;
123
               Y := 'Y';
124
               Z := 'Z';
125
          END P5;
126
 
127
     BEGIN
128
 
129
          IF N1(2) /= 2 THEN
130
               FAILED ("WRONG VALUE FOR EXPRESSION - N1");
131
          END IF;
132
          N1(2) := 7;
133
          IF N1 /= (1,7,3,4) THEN
134
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N1");
135
          END IF;
136
          N1 := (1,2,3,4);
137
          P1 (N1(2), N1(3), N1(1), "N1");
138
          IF N1 /= (9,2,8,4) THEN
139
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N1");
140
          END IF;
141
 
142
          IF N2(3) /= 3 THEN
143
               FAILED ("WRONG VALUE FOR EXPRESSION - N2");
144
          END IF;
145
          N2(3) := 7;
146
          IF N2.ALL /= (1,2,7,4) THEN
147
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N2");
148
          END IF;
149
          N2.ALL := (2,1,4,3);
150
          P1 (N2(1), N2(4), N2(2), "N2");
151
          IF N2.ALL /= (2,9,4,8) THEN
152
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N2");
153
          END IF;
154
 
155
          IF "&" (STRING'("AB"), STRING'("CDEF"))(5) /= CHARACTER'('E') THEN
156
               FAILED ("WRONG VALUE FOR EXPRESSION - '&'");
157
          END IF;
158
          P2 ("&" ("AB", "CD")(3));
159
 
160
          IF F1(3) /= TRUE THEN
161
               FAILED ("WRONG VALUE FOR EXPRESSION - F1");
162
          END IF;
163
          P3 (F1(3));
164
 
165
          N2 := NEW A1' (1,2,3,4);
166
          IF F2(2) /= 2 THEN
167
               FAILED ("WRONG VALUE FOR EXPRESSION - F2");
168
          END IF;
169
          F2(3) := 7;
170
          IF N2.ALL /= (1,2,7,4) THEN
171
               FAILED ("WRONG TARGET FOR ASSIGNMENT - F2");
172
          END IF;
173
          N2.ALL := (1,2,3,4);
174
          P1 (F2(2), F2(3), F2(1), "F2");
175
          IF N2.ALL /= (9,2,8,4) THEN
176
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - F2");
177
          END IF;
178
 
179
          IF N3(2..5)(5) /= 5 THEN
180
               FAILED ("WRONG VALUE FOR EXPRESSION - N3");
181
          END IF;
182
          N3(2..5)(2) := 8;
183
          IF N3 /= (1,8,3,4,5,6,7) THEN
184
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N3");
185
          END IF;
186
          N3 := (5,3,4,2,1,6,7);
187
          P1 (N3(2..5)(4), N3(2..5)(2), N3(2..5)(5), "N3");
188
          IF N3 /= (5,8,4,2,9,6,7) THEN
189
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N3");
190
          END IF;
191
 
192
          IF N4(1)(2) /= 2 THEN
193
               FAILED ("WRONG VALUE FOR EXPRESSION - N4");
194
          END IF;
195
          N4(3)(1) := 20;
196
          IF N4 /= ((1,2,3,4),(5,6,7,8),(20,10,11,12),
197
                    (13,14,15,16)) THEN
198
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N4");
199
          END IF;
200
          N4 := (1 => (0,6,4,2), 2 => (10,11,12,13),
201
                 3 => (14,15,16,17), 4 => (7,5,3,1));
202
          P1 (N4(1)(4), N4(4)(3), N4(2)(1), "N4");
203
          IF N4 /= ((0,6,4,2),(9,11,12,13),(14,15,16,17),
204
                    (7,5,8,1)) THEN
205
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N4");
206
          END IF;
207
 
208
          N1 := (1,2,3,4);
209
          IF C41103A.N1(2) /= 2 THEN
210
               FAILED ("WRONG VALUE FOR EXPRESSION - C41103A.N1");
211
          END IF;
212
          C41103A.N1(2) := 7;
213
          IF N1 /= (1,7,3,4) THEN
214
               FAILED ("WRONG TARGET FOR ASSIGNMENT - C41103A.N1");
215
          END IF;
216
          N1 := (1,2,3,4);
217
          P1 (C41103A.N1(2), C41103A.N1(3), C41103A.N1(1),
218
              "C41103A.N1");
219
          IF N1 /= (9,2,8,4) THEN
220
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER " &
221
                      "- C41103A.N1");
222
          END IF;
223
 
224
          IF N5.S(3) /= 'C' THEN
225
               FAILED ("WRONG VALUE FOR EXPRESSION - N5");
226
          END IF;
227
          N5.S(4) := 'X';
228
          IF N5.S /= "ABCX" THEN
229
               FAILED ("WRONG TARGET FOR ASSIGNMENT - N5");
230
          END IF;
231
          N5.S := "ABCD";
232
          P5 (N5.S(1), N5.S(4), N5.S(2));
233
          IF N5.S /= "AZCY" THEN
234
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - N5");
235
          END IF;
236
     END;
237
 
238
     RESULT;
239
END C41103A;

powered by: WebSVN 2.1.0

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