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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C37009A.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 AN UNCONSTRAINED RECORD TYPE CAN BE USED TO DECLARE A
27
--     RECORD COMPONENT THAT CAN BE INITIALIZED WITH AN APPROPRIATE
28
--     EXPLICIT OR DEFAULT VALUE.
29
 
30
-- HISTORY:
31
--     DHH 02/01/88 CREATED ORIGINAL TEST.
32
 
33
WITH REPORT; USE REPORT;
34
 
35
PROCEDURE C37009A IS
36
 
37
     TYPE FLOAT IS DIGITS 5;
38
     TYPE COLOR IS (RED, YELLOW, BLUE);
39
 
40
     TYPE COMPONENT IS
41
          RECORD
42
               I : INTEGER := 1;
43
               X : FLOAT := 3.5;
44
               BOL : BOOLEAN := FALSE;
45
               FIRST : COLOR := RED;
46
          END RECORD;
47
     TYPE COMP_DIS(A : INTEGER := 1) IS
48
          RECORD
49
               I : INTEGER := 1;
50
               X : FLOAT := 3.5;
51
               BOL : BOOLEAN := FALSE;
52
               FIRST : COLOR := RED;
53
          END RECORD;
54
     SUBTYPE SMAL_INTEGER IS INTEGER RANGE 1 .. 10;
55
     TYPE LIST IS ARRAY(INTEGER RANGE <>) OF FLOAT;
56
 
57
     TYPE DISCRIM(P : SMAL_INTEGER := 2) IS
58
          RECORD
59
               A : LIST(1 .. P) := (1 .. P => 1.25);
60
          END RECORD;
61
 
62
     TYPE REC_T IS                                     -- EXPLICIT INIT.
63
          RECORD
64
               T : COMPONENT := (5, 6.0, TRUE, YELLOW);
65
               U : DISCRIM(3) := (3, (1 .. 3 => 2.25));
66
               L : COMP_DIS(5) := (A => 5, I => 5, X => 6.0,
67
                                      BOL =>TRUE, FIRST => YELLOW);
68
          END RECORD;
69
 
70
     TYPE REC_DEF_T IS                                 -- DEFAULT INIT.
71
          RECORD
72
               T : COMPONENT;
73
               U : DISCRIM;
74
               L : COMP_DIS;
75
          END RECORD;
76
 
77
     REC : REC_T;
78
     REC_DEF : REC_DEF_T;
79
 
80
     FUNCTION IDENT_FLT(X : FLOAT) RETURN FLOAT IS
81
     BEGIN
82
          IF EQUAL(3,3) THEN
83
               RETURN X;
84
          ELSE
85
               RETURN 0.0;
86
          END IF;
87
     END IDENT_FLT;
88
 
89
     FUNCTION IDENT_ENUM(X : COLOR) RETURN COLOR IS
90
     BEGIN
91
          IF EQUAL(3,3) THEN
92
               RETURN X;
93
          ELSE
94
               RETURN BLUE;
95
          END IF;
96
     END IDENT_ENUM;
97
 
98
BEGIN
99
     TEST("C37009A", "CHECK THAT AN UNCONSTRAINED RECORD TYPE CAN " &
100
                     "BE USED TO DECLARE A RECORD COMPONENT THAT " &
101
                     "CAN BE INITIALIZED WITH AN APPROPRIATE " &
102
                     "EXPLICIT OR DEFAULT VALUE");
103
 
104
     IF REC_DEF.T.I /= IDENT_INT(1) THEN
105
          FAILED("INCORRECT DEFAULT INITIALIZATION OF INTEGER");
106
     END IF;
107
 
108
     IF IDENT_BOOL(REC_DEF.T.BOL) THEN
109
          FAILED("INCORRECT DEFAULT INITIALIZATION OF BOOLEAN");
110
     END IF;
111
 
112
     IF REC_DEF.T.X /= IDENT_FLT(3.5) THEN
113
          FAILED("INCORRECT DEFAULT INITIALIZATION OF REAL");
114
     END IF;
115
 
116
     IF REC_DEF.T.FIRST /= IDENT_ENUM(RED) THEN
117
          FAILED("INCORRECT DEFAULT INITIALIZATION OF ENUMERATION");
118
     END IF;
119
 
120
     FOR I IN 1 .. 2 LOOP
121
          IF REC_DEF.U.A(I) /= IDENT_FLT(1.25) THEN
122
               FAILED("INCORRECT DEFAULT INITIALIZATION OF ARRAY " &
123
                      "POSITION " & INTEGER'IMAGE(I));
124
          END IF;
125
     END LOOP;
126
 
127
     IF REC_DEF.L.A /= IDENT_INT(1) THEN
128
          FAILED("INCORRECT DEFAULT INITIALIZATION OF DISCRIMINANT " &
129
                 "- L");
130
     END IF;
131
 
132
     IF REC_DEF.L.I /= IDENT_INT(1) THEN
133
          FAILED("INCORRECT DEFAULT INITIALIZATION OF INTEGER - L");
134
     END IF;
135
 
136
     IF IDENT_BOOL(REC_DEF.L.BOL) THEN
137
          FAILED("INCORRECT DEFAULT INITIALIZATION OF BOOLEAN - L");
138
     END IF;
139
 
140
     IF REC_DEF.L.X /= IDENT_FLT(3.5) THEN
141
          FAILED("INCORRECT DEFAULT INITIALIZATION OF REAL - L");
142
     END IF;
143
 
144
     IF REC_DEF.L.FIRST /= IDENT_ENUM(RED) THEN
145
          FAILED("INCORRECT DEFAULT INITIALIZATION OF ENUMERATION - L");
146
     END IF;
147
--------------------------------------------------------------------
148
     IF REC.T.I /= IDENT_INT(5) THEN
149
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF INTEGER");
150
     END IF;
151
 
152
     IF NOT IDENT_BOOL(REC.T.BOL) THEN
153
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF BOOLEAN");
154
     END IF;
155
 
156
     IF REC.T.X /= IDENT_FLT(6.0) THEN
157
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF REAL");
158
     END IF;
159
 
160
     IF REC.T.FIRST /= YELLOW THEN
161
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF ENUMERATION");
162
     END IF;
163
 
164
     FOR I IN 1 .. 3 LOOP
165
          IF REC.U.A(I) /= IDENT_FLT(2.25) THEN
166
               FAILED("INCORRECT EXPLICIT INITIALIZATION OF ARRAY " &
167
                      "POSITION " & INTEGER'IMAGE(I));
168
          END IF;
169
     END LOOP;
170
 
171
     IF REC.L.A /= IDENT_INT(5) THEN
172
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF DISCRIMINANT " &
173
                 "- L");
174
     END IF;
175
 
176
     IF REC.L.I /= IDENT_INT(5) THEN
177
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF INTEGER - L");
178
     END IF;
179
 
180
     IF NOT IDENT_BOOL(REC.L.BOL) THEN
181
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF BOOLEAN - L");
182
     END IF;
183
 
184
     IF REC.L.X /= IDENT_FLT(6.0) THEN
185
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF REAL - L");
186
     END IF;
187
 
188
     IF REC.L.FIRST /= IDENT_ENUM(YELLOW) THEN
189
          FAILED("INCORRECT EXPLICIT INITIALIZATION OF ENUMERATION " &
190
                 "- L");
191
     END IF;
192
 
193
     RESULT;
194
 
195
END C37009A;

powered by: WebSVN 2.1.0

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