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 a Size clause for an object is supported if the specified
28 -- size is at least as large as the subtype's size, and correspond to a
29 -- size in storage elements that is a multiple of the object's (non-zero)
30 -- Alignment. RM 13.3(43)
33 -- This test defines several types and then asserts specific sizes for
34 -- the, it then checks that the size set is reported back.
36 -- APPLICABILITY CRITERIA:
37 -- All implementations must attempt to compile this test.
39 -- For implementations validating against Systems Programming Annex (C):
40 -- this test must execute and report PASSED.
42 -- For implementations not validating against Annex C:
43 -- this test may report compile time errors at one or more points
44 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
45 -- Otherwise, the test must execute and report PASSED.
49 -- 22 JUL 95 SAIC Initial version
50 -- 08 MAY 96 SAIC Corrected and strengthened for 2.1
51 -- 14 FEB 97 PWB.CTA Changed 'Size specifications to multiples
52 -- of System.Storage_Unit; restricted 'Size spec
53 -- for enumeration object to max integer size.
54 -- 16 FEB 98 EDS Modify Documentation.
55 -- 25 JAN 99 RLB Repaired to properly set and check sizes.
56 -- 29 JAN 99 RLB Added Pack pragma needed for some implementations.
57 -- Corrected to support a Storage_Unit size < 8.
60 ------------------------------------------------------------------- CD30003
66 ---------------------------------------------------------------------------
68 ---------------------------------------------------------------------------
71 for Bit
'Size use 1; -- ANX-C RQMT.
73 type Byte
is mod 2**8;
74 for Byte
'Size use 8; -- ANX-C RQMT.
76 type Smallword
is mod 2**8;
77 for Smallword
'size use 16; -- ANX-C RQMT.
79 type Byte_Array
is array(1..4) of Byte
;
80 pragma Pack
(Byte_Array
); -- ANX-C RQMT.
83 type Smallword_Array
is array(1..4) of Smallword
;
84 pragma Pack
(Smallword_Array
); -- Required if Storage_Unit > 16. -- ANX-C RQMT.
86 -- Use to calulate maximum required size:
87 type Max_Modular
is mod System
.Max_Binary_Modulus
;
88 type Max_Integer
is range System
.Min_Int
.. System
.Max_Int
;
89 Enum_Size
: constant := Integer'Min (32,
90 Integer'Min (Max_Modular
'Size, Max_Integer
'Size));
91 type Transmission_Data
is ( Empty
, Input
, Output
, IO
, Control
);
92 for Transmission_Data
'Size use Enum_Size
; -- ANX-C RQMT.
96 -- The basic sizes are based on a "normal" Storage_Unit = 8 implementation.
97 -- We then use formulas to insure that the specified sizes meet the
98 -- the minimum level of support and AI-0051.
100 Modular_Single_Size
: constant := Integer'Min (((8 + (System
.Storage_Unit
-1))
101 /System
.Storage_Unit
)*System
.Storage_Unit
, Max_Modular
'Size);
102 -- Calulate an appropriate, legal, and required to be supported size to
103 -- try, which is the size of Byte. Note that object sizes must be
104 -- a multiple of the storage unit for the compiler.
106 Modular_Double_Size
: constant := Integer'Min (((16 + (System
.Storage_Unit
-1))
107 /System
.Storage_Unit
)*System
.Storage_Unit
, Max_Modular
'Size);
109 Modular_Quad_Size
: constant := Integer'Min (((32 + (System
.Storage_Unit
-1))
110 /System
.Storage_Unit
)*System
.Storage_Unit
, Max_Modular
'Size);
112 Array_Quad_Size
: constant := ((4 * 8 + (System
.Storage_Unit
-1))
113 /System
.Storage_Unit
)*System
.Storage_Unit
;
115 Array_Octo_Size
: constant := ((4 * 16 + (System
.Storage_Unit
-1))
116 /System
.Storage_Unit
)*System
.Storage_Unit
;
118 Rounded_Enum_Size
: constant := ((Enum_Size
+ (System
.Storage_Unit
-1))
119 /System
.Storage_Unit
)*System
.Storage_Unit
;
121 Enum_Quad_Size
: constant := Integer'Min (((32 + (System
.Storage_Unit
-1))
122 /System
.Storage_Unit
)*System
.Storage_Unit
,
123 Integer'Min (Max_Modular
'Size, Max_Integer
'Size));
126 ---------------------------------------------------------------------------
128 ---------------------------------------------------------------------------
131 for Bit_8
'Size use System
.Storage_Unit
; -- ANX-C RQMT.
134 for Bit_G
'Size use Modular_Double_Size
; -- ANX-C RQMT.
137 for Byte_8
'Size use Modular_Single_Size
; -- ANX-C RQMT.
140 for Byte_G
'Size use Modular_Double_Size
; -- ANX-C RQMT.
142 Smallword_1
: Smallword
:=0;
143 for Smallword_1
'Size use Modular_Double_Size
; -- ANX-C RQMT.
145 Smallword_2
: Smallword
:=0;
146 for Smallword_2
'Size use Modular_Quad_Size
; -- ANX-C RQMT.
148 Byte_Array_1
: Byte_Array
:= (others=>0);
149 for Byte_Array_1
'Size use Array_Quad_Size
; -- ANX-C RQMT.
151 Smallword_Array_1
: Smallword_Array
:= (others=>0);
152 for Smallword_Array_1
'Size use Array_Octo_Size
; -- ANX-C RQMT.
154 Transmission_Data_1
: aliased Transmission_Data
:= Empty
;
156 Transmission_Data_2
: Transmission_Data
:= Control
;
157 for Transmission_Data_2
'Size use Enum_Quad_Size
; -- ANX-C RQMT.
159 begin -- Main test procedure.
161 Report
.Test
("CD30003", "Check that Size clauses are supported for " &
162 "values at least as large as the subtypes " &
163 "size, and correspond to a size in storage " &
164 "elements that is a multiple of the objects " &
165 "(non-zero) Alignment" );
167 if Bit_8
'Size /= System
.Storage_Unit
then
168 Report
.Failed
("Expected Bit_8'Size =" & Integer'Image(System
.Storage_Unit
)
169 & " , actually =" & Integer'Image(Bit_8
'Size));
172 if Bit_G
'Size /= Modular_Double_Size
then
173 Report
.Failed
("Expected Bit_G'Size =" & Integer'Image(Modular_Double_Size
)
174 & " , actually =" & Integer'Image(Bit_G
'Size));
177 if Byte_8
'Size /= Modular_Single_Size
then
178 Report
.Failed
("Expected Byte_8'Size =" & Integer'Image(Modular_Single_Size
)
179 & " , actually =" & Integer'Image(Byte_8
'Size));
182 if Byte_G
'Size /= Modular_Double_Size
then
183 Report
.Failed
("Expected Bit_G'Size =" & Integer'Image(Modular_Double_Size
)
184 & " , actually =" & Integer'Image(Byte_G
'Size));
187 if Smallword_1
'Size /= Modular_Double_Size
then
188 Report
.Failed
("Expected Smallword_1'Size =" &
189 Integer'Image(Modular_Double_Size
) &
190 ", actually =" & Integer'Image(Smallword_1
'Size));
193 if Smallword_2
'Size /= Modular_Quad_Size
then
194 Report
.Failed
("Expected Smallword_2'Size =" &
195 Integer'Image(Modular_Quad_Size
) &
196 ", actually =" & Integer'Image(Smallword_2
'Size));
199 if Byte_Array_1
'Size /= Array_Quad_Size
then
200 Report
.Failed
("Expected Byte_Array_1'Size =" &
201 Integer'Image(Array_Quad_Size
) &
202 ", actually =" & Integer'Image(Byte_Array_1
'Size));
205 if Smallword_Array_1
'Size /= Array_Octo_Size
then
207 "Expected Smallword_Array_1'Size =" &
208 Integer'Image(Array_Octo_Size
) &
209 ", actually =" & Integer'Image(Smallword_Array_1
'Size));
212 if Transmission_Data_1
'Size /= Enum_Size
and then
213 Transmission_Data_1
'Size /= Rounded_Enum_Size
then
215 "Expected Transmission_Data_1'Size =" & Integer'Image(Rounded_Enum_Size
) &
216 ", actually =" & Integer'Image(Transmission_Data_1
'Size));
219 if Transmission_Data_2
'Size /= Enum_Quad_Size
then
221 "Expected Transmission_Data_2'Size =" & Integer'Image(Enum_Quad_Size
) &
222 ", actually =" & Integer'Image(Transmission_Data_2
'Size));