OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c43103b.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C43103B.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 IF A DISCRIMINANT DOES NOT GOVERN A VARIANT PART, ITS
26
-- VALUE CAN BE GIVEN BY A NONSTATIC EXPRESSION.
27
-- ADDITIONAL CASES OF USE OF A DISCRIMINANT THAT IS USED AS AN
28
-- ARRAY INDEX BOUND.
29
 
30
-- PK  02/21/84
31
-- EG  05/30/84
32
-- EG  11/02/84
33
-- DN  12/01/95  REMOVED CONFORMANCE CHECKS WHERE RULES RELAXED.
34
-- PWN 10/25/96  RESTORED CHECK WITH ADA 95 EXPECTED RESULTS INCLUDED.
35
 
36
WITH REPORT;
37
USE REPORT;
38
 
39
PROCEDURE C43103B IS
40
 
41
     SUBTYPE INT IS INTEGER RANGE 1 .. 3;
42
 
43
     TYPE A2 IS ARRAY(INT RANGE <>, INT RANGE <>) OF INTEGER;
44
 
45
     SUBTYPE DINT IS INTEGER RANGE 0 .. 10;
46
 
47
     TYPE REC(D, E : DINT := IDENT_INT(1)) IS RECORD
48
          U : A2(1 .. D, E .. 3) := (1 .. D =>
49
                                     (E .. 3 => IDENT_INT(1)));
50
     END RECORD;
51
 
52
BEGIN
53
 
54
     TEST("C43103B","CHECK THAT IF A DISCRIMINANT DOES NOT GOVERN " &
55
                    "A VARIANT PART, ITS VALUE CAN BE GIVEN BY A "  &
56
                    "NONSTATIC EXPRESSION");
57
 
58
-- SIMPLE DECLARATIONS
59
 
60
     BEGIN
61
 
62
          DECLARE
63
 
64
               L : REC(IDENT_INT(2), IDENT_INT(2));
65
               K : REC(IDENT_INT(0), IDENT_INT(1));
66
               M : REC(IDENT_INT(3), IDENT_INT(4));
67
 
68
          BEGIN
69
               IF L.U'FIRST(1) /= IDENT_INT(1) OR
70
                  L.U'LAST(1)  /= IDENT_INT(2) OR
71
                  L.U'FIRST(2) /= IDENT_INT(2) OR
72
                  L.U'LAST(2)  /= IDENT_INT(3) THEN
73
                    FAILED("1.1 - INCORRECT BOUNDS");
74
               END IF;
75
               IF K.U'FIRST(1) /= IDENT_INT(1) OR
76
                  K.U'LAST(1)  /= IDENT_INT(0) OR
77
                  K.U'FIRST(2) /= IDENT_INT(1) OR
78
                  K.U'LAST(2)  /= IDENT_INT(3) THEN
79
                    FAILED("1.2 - INCORRECT BOUNDS");
80
               END IF;
81
               IF M.U'FIRST(1) /= IDENT_INT(1) OR
82
                  M.U'LAST(1)  /= IDENT_INT(3) OR
83
                  M.U'FIRST(2) /= IDENT_INT(4) OR
84
                  M.U'LAST(2)  /= IDENT_INT(3) THEN
85
                    FAILED("1.3 - INCORRECT BOUNDS");
86
               END IF;
87
               IF M.U'LENGTH(1) /= 3 OR M.U'LENGTH(2) /= 0 THEN
88
                    FAILED("1.4 - INCORRECT ARRAY LENGTH");
89
               END IF;
90
          END;
91
 
92
     EXCEPTION
93
 
94
          WHEN OTHERS =>
95
               FAILED ("1.5 - EXCEPTION RAISED");
96
 
97
     END;
98
 
99
-- EXPLICIT INITIAL VALUE - OK
100
 
101
     BEGIN
102
 
103
          DECLARE
104
               O : CONSTANT REC := (IDENT_INT(2), IDENT_INT(2),
105
                        ((1, IDENT_INT(2)), (IDENT_INT(2), 3)));
106
          BEGIN
107
               IF O.U'FIRST(1) /= IDENT_INT(1) OR
108
                  O.U'LAST(1)  /= IDENT_INT(2) OR
109
                  O.U'FIRST(2) /= IDENT_INT(2) OR
110
                  O.U'LAST(2)  /= IDENT_INT(3) THEN
111
                    FAILED("2.1 - INCORRECT BOUNDS");
112
               END IF;
113
          END;
114
 
115
     EXCEPTION
116
 
117
          WHEN OTHERS =>
118
               FAILED ("2.2 - EXCEPTION RAISED");
119
     END;
120
 
121
-- EXPLICIT INITIAL VALUE: NULL ARRAY WITH WRONG BOUNDS
122
 
123
     BEGIN
124
 
125
          DECLARE
126
               P : CONSTANT REC := (IDENT_INT(0), IDENT_INT(2),
127
                                    (IDENT_INT(3) .. IDENT_INT(0) =>
128
                                     (IDENT_INT(2), 3)));
129
          BEGIN
130
                NULL;
131
          END;
132
 
133
     EXCEPTION
134
 
135
          WHEN CONSTRAINT_ERROR =>
136
               FAILED ("3.1 -  CONSTRAINT_ERROR RAISED");
137
          WHEN OTHERS =>
138
               FAILED ("3.2 -  WRONG EXCEPTION RAISED");
139
     END;
140
 
141
-- EXPLICIT INITIAL VALUE: NULL ARRAY WITH WRONG BOUNDS
142
 
143
     BEGIN
144
 
145
          DECLARE
146
               P : CONSTANT REC := (IDENT_INT(0), IDENT_INT(2),
147
                                    (IDENT_INT(3) .. IDENT_INT(0) =>
148
                                     (OTHERS => IDENT_INT(2))));
149
          BEGIN
150
               NULL;
151
          END;
152
 
153
     EXCEPTION
154
 
155
          WHEN CONSTRAINT_ERROR =>
156
               FAILED ("4.1 - CONSTRAINT_ERROR RAISED");
157
          WHEN OTHERS =>
158
               FAILED ("4.2 - WRONG EXCEPTION RAISED");
159
 
160
     END;
161
 
162
-- EXPLICIT INITIAL VALUE: NULL ARRAY WITH WRONG BOUNDS 2ND DIM.
163
 
164
     BEGIN
165
 
166
          DECLARE
167
               P : CONSTANT REC := (IDENT_INT(0), IDENT_INT(2),
168
                                    (IDENT_INT(1) .. IDENT_INT(0) =>
169
                                     (IDENT_INT(1) .. IDENT_INT(2) =>
170
                                      1)));
171
          BEGIN
172
               NULL;
173
          END;
174
 
175
     EXCEPTION
176
 
177
          WHEN CONSTRAINT_ERROR =>
178
               FAILED ("5.1 - CONSTRAINT_ERROR RAISED");
179
          WHEN OTHERS =>
180
               FAILED ("5.2 - WRONG EXCEPTION RAISED");
181
 
182
     END;
183
 
184
     RESULT;
185
 
186
END C43103B;

powered by: WebSVN 2.1.0

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