3 -- Grant of Unlimited Rights
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
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.
27 -- Check that, for an array aggregate without an others choice assigned
28 -- to an object of a constrained array subtype, Constraint_Error is not
29 -- raised if the length of each dimension of the aggregate equals the
30 -- length of the corresponding dimension of the target object, even if
31 -- the bounds of the corresponding index ranges do not match.
34 -- The test verifies that sliding of array bounds is performed on array
35 -- aggregates that are part of a larger aggregate, where the bounds of
36 -- the corresponding index ranges do not match but the lengths of the
37 -- corresponding dimensions are the same. Both aggregates containing
38 -- named associations and positional associations are checked. Cases
39 -- involving static and nonstatic index constraints, as well as pre-
40 -- defined and modular integer index subtypes, are included.
44 -- 15 Apr 96 SAIC Prerelease version for ACVC 2.1.
45 -- 20 Oct 96 SAIC Removed unnecessary parentheses and type
51 pragma Elaborate
(Report
);
55 type Modular_Type
is mod 10; -- Range 0 .. 9.
58 Two
: Modular_Type
:= Modular_Type
(Report
.Ident_Int
(2));
59 Four
: Modular_Type
:= Modular_Type
(Report
.Ident_Int
(4));
61 type Array_Modular_Index
is array (Modular_Type
range <>) of Integer;
63 subtype Array_Static_Modular_Constraint
is Array_Modular_Index
(2..4);
64 subtype Array_Nonstatic_Modular_Constraint
is Array_Modular_Index
(Two
..Four
);
69 --==================================================================--
73 pragma Elaborate
(Report
);
77 One
: Integer := Report
.Ident_Int
(1);
78 Ten
: Integer := Report
.Ident_Int
(10);
80 subtype Integer_Subtype
is Integer range One
.. Ten
;
83 Two
: Integer := Report
.Ident_Int
(2);
84 Four
: Integer := Report
.Ident_Int
(4);
86 type Array_Integer_Index
is array (Integer_Subtype
range <>) of Boolean;
88 subtype Array_Static_Integer_Constraint
is Array_Integer_Index
(2..4);
89 subtype Array_Nonstatic_Integer_Constraint
is Array_Integer_Index
(Two
..Four
);
94 --==================================================================--
97 -- Generic equality function:
100 type Operand_Type
is private;
101 function C460010_2
(L
, R
: Operand_Type
) return Boolean;
104 function C460010_2
(L
, R
: Operand_Type
) return Boolean is
110 --==================================================================--
121 generic function Generic_Equality
renames C460010_2
;
124 Report
.Test
("C460010", "Check that Constraint_Error is not raised if " &
125 "an array aggregate without an others choice is assigned " &
126 "to an object of a constrained array subtype, and the " &
127 "length of each dimension of the aggregate equals the " &
128 "length of the corresponding dimension of the target object");
131 ---=---=---=---=---=---=---=---=---=---=---
135 type Arr
is array (1..1) of C460010_0
.Array_Static_Modular_Constraint
;
136 function Equals
is new Generic_Equality
(Arr
);
139 ---=---=---=---=---=---=---
142 Target
:= (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
144 if not Equals
(Target
, Target
) then
145 Report
.Failed
("Avoid optimization"); -- Never executed.
148 when Constraint_Error
=>
149 Report
.Failed
("Constraint_Error raised: Case 1");
151 Report
.Failed
("Unexpected exception raised: Case 1");
154 ---=---=---=---=---=---=---
158 Target
:= (1 => (5, 10, 15)); -- Positional associations.
160 if not Equals
(Target
, Target
) then
161 Report
.Failed
("Avoid optimization"); -- Never executed.
164 when Constraint_Error
=>
165 Report
.Failed
("Constraint_Error raised: Case 2");
167 Report
.Failed
("Unexpected exception raised: Case 2");
170 ---=---=---=---=---=---=---
174 ---=---=---=---=---=---=---=---=---=---=---
178 type Rec
(Disc
: C460010_0
.Modular_Type
:= 4) is record
179 Arr
: C460010_0
.Array_Modular_Index
(2 .. Disc
);
182 function Equals
is new Generic_Equality
(Rec
);
185 ---=---=---=---=---=---=---
188 Target
:= (Disc
=> 4, Arr
=> (1 => 1, 2 => 2, 3 => 3)); -- Named.
190 if not Equals
(Target
, Target
) then
191 Report
.Failed
("Avoid optimization"); -- Never executed.
194 when Constraint_Error
=>
195 Report
.Failed
("Constraint_Error raised: Case 3");
197 Report
.Failed
("Unexpected exception raised: Case 3");
200 ---=---=---=---=---=---=---
204 Target
:= (Disc
=> 4, Arr
=> (1 ,2, 3)); -- Positional.
206 if not Equals
(Target
, Target
) then
207 Report
.Failed
("Avoid optimization"); -- Never executed.
210 when Constraint_Error
=>
211 Report
.Failed
("Constraint_Error raised: Case 4");
213 Report
.Failed
("Unexpected exception raised: Case 4");
216 ---=---=---=---=---=---=---
220 ---=---=---=---=---=---=---=---=---=---=---
224 type Arr
is array (1..1) of C460010_0
.Array_Nonstatic_Modular_Constraint
;
225 function Equals
is new Generic_Equality
(Arr
);
228 ---=---=---=---=---=---=---
231 Target
:= (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
233 if not Equals
(Target
, Target
) then
234 Report
.Failed
("Avoid optimization"); -- Never executed.
237 when Constraint_Error
=>
238 Report
.Failed
("Constraint_Error raised: Case 5");
240 Report
.Failed
("Unexpected exception raised: Case 5");
243 ---=---=---=---=---=---=---
247 Target
:= (1 => ((5, 10, 15))); -- Positional associations.
249 if not Equals
(Target
, Target
) then
250 Report
.Failed
("Avoid optimization"); -- Never executed.
253 when Constraint_Error
=>
254 Report
.Failed
("Constraint_Error raised: Case 6");
256 Report
.Failed
("Unexpected exception raised: Case 6");
259 ---=---=---=---=---=---=---
263 ---=---=---=---=---=---=---=---=---=---=---
267 type Arr
is array (1..1) of C460010_1
.Array_Static_Integer_Constraint
;
268 function Equals
is new Generic_Equality
(Arr
);
271 ---=---=---=---=---=---=---
274 Target
:= (1 => (1 => True, 2 => True, 3 => False)); -- Named.
276 if not Equals
(Target
, Target
) then
277 Report
.Failed
("Avoid optimization"); -- Never executed.
280 when Constraint_Error
=>
281 Report
.Failed
("Constraint_Error raised: Case 7");
283 Report
.Failed
("Unexpected exception raised: Case 7");
286 ---=---=---=---=---=---=---
290 Target
:= (1 => ((False, False, True))); -- Positional.
292 if not Equals
(Target
, Target
) then
293 Report
.Failed
("Avoid optimization"); -- Never executed.
296 when Constraint_Error
=>
297 Report
.Failed
("Constraint_Error raised: Case 8");
299 Report
.Failed
("Unexpected exception raised: Case 8");
302 ---=---=---=---=---=---=---
306 ---=---=---=---=---=---=---=---=---=---=---
310 type Arr
is array (1..1) of C460010_1
.Array_Nonstatic_Integer_Constraint
;
311 function Equals
is new Generic_Equality
(Arr
);
314 ---=---=---=---=---=---=---
317 Target
:= (1 => (1 => True, 2 => True, 3 => False)); -- Named.
319 if not Equals
(Target
, Target
) then
320 Report
.Failed
("Avoid optimization"); -- Never executed.
323 when Constraint_Error
=>
324 Report
.Failed
("Constraint_Error raised: Case 9");
326 Report
.Failed
("Unexpected exception raised: Case 9");
329 ---=---=---=---=---=---=---
333 Target
:= (1 => (False, False, True)); -- Positional.
335 if not Equals
(Target
, Target
) then
336 Report
.Failed
("Avoid optimization"); -- Never executed.
339 when Constraint_Error
=>
340 Report
.Failed
("Constraint_Error raised: Case 10");
342 Report
.Failed
("Unexpected exception raised: Case 10");
345 ---=---=---=---=---=---=---
349 ---=---=---=---=---=---=---=---=---=---=---