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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C41301A.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 NOTATION L.R MAY BE USED TO DENOTE A RECORD COMPONENT,
26
--   WHERE R IS THE IDENTIFIER OF SUCH COMPONENT, AND L MAY BE ANY OF
27
--   THE FOLLOWING:
28
--        AN IDENTIFIER DENOTING A RECORD OBJECT - X2;
29
--        AN IDENTIFIER DENOTING AN ACCESS OBJECT WHOSE VALUE DESIGNATES
30
--           A RECORD OBJECT - X3;
31
--        A FUNCTION CALL DELIVERING A RECORD VALUE - F1;
32
--        A FUNCTION CALL DELIVERING AN ACCESS VALUE DESIGNATING A
33
--           RECORD OBJECT - F2;
34
--        AN INDEXED COMPONENT - X4;
35
--        AN IDENTIFIER PREFIXED BY THE NAME OF THE INNERMOST UNIT
36
--           ENCLOSING THE IDENTIFIER'S DECLARATION - C41301A.X1;
37
--        A SELECTED COMPONENT DENOTING A RECORD (WHICH IS A COMPONENT
38
--           OF ANOTHER RECORD) - X5.
39
 
40
-- WKB 8/13/81
41
-- JRK 8/17/81
42
-- SPS 10/26/82
43
 
44
WITH REPORT;
45
USE REPORT;
46
PROCEDURE C41301A IS
47
 
48
     TYPE T1 IS
49
          RECORD
50
               A : INTEGER;
51
               B : BOOLEAN;
52
               C : BOOLEAN;
53
          END RECORD;
54
     X1 : T1 := (A=>1, B=>TRUE, C=>FALSE);
55
 
56
BEGIN
57
     TEST ("C41301A", "CHECK THAT THE NOTATION L.R MAY BE USED TO " &
58
                      "DENOTE A RECORD COMPONENT, WHERE R IS THE " &
59
                      "IDENTIFIER AND L MAY BE OF CERTAIN FORMS");
60
 
61
     DECLARE
62
 
63
          TYPE T2 (DISC : INTEGER := 0) IS
64
               RECORD
65
                    D : BOOLEAN;
66
                    E : INTEGER;
67
                    F : BOOLEAN;
68
                    CASE DISC IS
69
                         WHEN 1 =>
70
                              G : BOOLEAN;
71
                         WHEN 2 =>
72
                              H : INTEGER;
73
                         WHEN OTHERS =>
74
                              NULL;
75
                    END CASE;
76
               END RECORD;
77
          X2 : T2(2) := (DISC=>2, D=>TRUE, E=>3, F=>FALSE, H=>1);
78
 
79
          TYPE T3 IS ACCESS T1;
80
          X3 : T3 := NEW T1' (A=>1, B=>TRUE, C=>FALSE);
81
 
82
          TYPE T4 IS ARRAY (1..3) OF T1;
83
          X4 : T4 := (1 => (1, TRUE, FALSE),
84
                      2 => (2, FALSE, TRUE),
85
                      3 => (3, TRUE, FALSE));
86
 
87
          TYPE T5 IS
88
               RECORD
89
                    I : INTEGER;
90
                    J : T1;
91
               END RECORD;
92
          X5 : T5 := (I => 5, J => (6, FALSE, TRUE));
93
 
94
          FUNCTION F1 RETURN T2 IS
95
          BEGIN
96
               RETURN (DISC=>1, D=>FALSE, E=>3, F=>TRUE, G=>FALSE);
97
          END F1;
98
 
99
          FUNCTION F2 RETURN T3 IS
100
          BEGIN
101
               RETURN X3;
102
          END F2;
103
 
104
          PROCEDURE P1 (X : IN BOOLEAN; Y : IN OUT INTEGER;
105
                        Z : OUT BOOLEAN; W : STRING) IS
106
          BEGIN
107
               IF X /= TRUE THEN
108
                    FAILED ("WRONG VALUE FOR IN PARAMETER - " & W);
109
               END IF;
110
               IF Y /= 1 THEN
111
                    FAILED ("WRONG VALUE FOR IN OUT PARAMETER - " & W);
112
               END IF;
113
               Y := 10;
114
               Z := TRUE;
115
          END P1;
116
 
117
          PROCEDURE P2 (X : IN INTEGER) IS
118
          BEGIN
119
               IF X /= 1 THEN
120
                    FAILED ("WRONG VALUE FOR IN PARAMETER - F1");
121
               END IF;
122
          END P2;
123
 
124
     BEGIN
125
 
126
          IF X2.E /= 3 THEN
127
               FAILED ("WRONG VALUE FOR EXPRESSION - X2");
128
          END IF;
129
          X2.E := 5;
130
          IF X2 /= (2, TRUE, 5, FALSE, 1) THEN
131
               FAILED ("WRONG TARGET FOR ASSIGNMENT - X2");
132
          END IF;
133
          X2 := (DISC=>2, D=>TRUE, E=>3, F=>FALSE, H=>1);
134
          P1 (X2.D, X2.H, X2.F, "X2");
135
          IF X2 /= (2, TRUE, 3, TRUE, 10) THEN
136
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - X2");
137
          END IF;
138
 
139
          IF X3.C /= FALSE THEN
140
               FAILED ("WRONG VALUE FOR EXPRESSION - X3");
141
          END IF;
142
          X3.A := 5;
143
          IF X3.ALL /= (5, TRUE, FALSE) THEN
144
               FAILED ("WRONG TARGET FOR ASSIGNMENT - X3");
145
          END IF;
146
          X3 := NEW T1 '(A=>1, B=>TRUE, C=>FALSE);
147
          P1 (X3.B, X3.A, X3.C, "X3");
148
          IF X3.ALL /= (10, TRUE, TRUE) THEN
149
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - X3");
150
          END IF;
151
 
152
          IF F1.G /= FALSE THEN
153
               FAILED ("WRONG VALUE FOR EXPRESSION - F1");
154
          END IF;
155
          P2 (F1.DISC);
156
 
157
          X3 := NEW T1' (A=>3, B=>FALSE, C=>TRUE);
158
          IF F2.B /= FALSE THEN
159
               FAILED ("WRONG VALUE FOR EXPRESSION - F2");
160
          END IF;
161
          F2.A := 4;
162
          IF X3.ALL /= (4, FALSE, TRUE) THEN
163
               FAILED ("WRONG TARGET FOR ASSIGNMENT - F2");
164
          END IF;
165
          X3 := NEW T1' (A=>1, B=>FALSE, C=>TRUE);
166
          P1 (F2.C, F2.A, F2.B, "F2");
167
          IF X3.ALL /= (10, TRUE, TRUE) THEN
168
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - F2");
169
          END IF;
170
 
171
          IF X4(2).C /= TRUE THEN
172
               FAILED ("WRONG VALUE FOR EXPRESSION - X4");
173
          END IF;
174
          X4(3).A := 4;
175
          IF X4 /= ((1,TRUE,FALSE), (2,FALSE,TRUE), (4,TRUE,FALSE)) THEN
176
               FAILED ("WRONG TARGET FOR ASSIGNMENT - X4");
177
          END IF;
178
          X4 := (1 => (2,TRUE,FALSE), 2 => (1,FALSE,TRUE),
179
                 3 => (3,TRUE,FALSE));
180
          P1 (X4(3).B, X4(2).A, X4(1).C, "X4");
181
          IF X4 /= ((2,TRUE,TRUE), (10,FALSE,TRUE), (3,TRUE,FALSE)) THEN
182
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - X4");
183
          END IF;
184
 
185
          X1 := (A=>1, B=>FALSE, C=>TRUE);
186
          IF C41301A.X1.C /= TRUE THEN
187
               FAILED ("WRONG VALUE FOR EXPRESSION - C41301A.X1");
188
          END IF;
189
          C41301A.X1.B := TRUE;
190
          IF X1 /= (1, TRUE, TRUE) THEN
191
               FAILED ("WRONG TARGET FOR ASSIGNMENT - C41301A.X1");
192
          END IF;
193
          X1 := (A=>1, B=>FALSE, C=>TRUE);
194
          P1 (C41301A.X1.C, C41301A.X1.A, C41301A.X1.B, "C41301A.X1");
195
          IF X1 /= (10, TRUE, TRUE) THEN
196
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - " &
197
                       "C41301A.X1");
198
          END IF;
199
 
200
          IF X5.J.C /= TRUE THEN
201
               FAILED ("WRONG VALUE FOR EXPRESSION - X5");
202
          END IF;
203
          X5.J.C := FALSE;
204
          IF X5 /= (5, (6, FALSE, FALSE)) THEN
205
               FAILED ("WRONG TARGET FOR ASSIGNMENT - X5");
206
          END IF;
207
          X5 := (I => 5, J => (A=>1, B=>TRUE, C=>FALSE));
208
          P1 (X5.J.B, X5.J.A, X5.J.C, "X5");
209
          IF X5 /= (5, (10, TRUE, TRUE)) THEN
210
               FAILED ("WRONG TARGET FOR (IN) OUT PARAMETER - X5");
211
          END IF;
212
 
213
     END;
214
 
215
     RESULT;
216
END C41301A;

powered by: WebSVN 2.1.0

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