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 the full type completing a type with no discriminant part
28 -- or an unknown discriminant part may have explicitly declared or
29 -- inherited discriminants.
30 -- Check for cases where the types are tagged records and task types.
33 -- Declare two groups of incomplete types: one group with no discriminant
34 -- part and one group with unknown discriminant part. Both groups of
35 -- incomplete types are completed with both explicit and inherited
36 -- discriminants. Discriminants for task types are declared with both
37 -- default and non default values. Discriminants for tagged types are
38 -- only declared without default values.
39 -- In the main program, verify that objects of both groups of incomplete
40 -- types can be created by default values or by assignments.
44 -- 23 Oct 95 SAIC Initial prerelease version.
45 -- 19 Oct 96 SAIC ACVC 2.1: modified test description. Initialized
52 subtype Small_Int
is Integer range 1 .. 15;
54 type Enu_Type
is (M
, F
);
56 type Tag_Type
is tagged
61 type NTag_Type
(D
: Small_Int
) is new Tag_Type
with
63 S
: String (1 .. D
) := "Aloha";
66 type Incomplete1
; -- no discriminant
68 type Incomplete2
(<>); -- unknown discriminant
70 type Incomplete3
; -- no discriminant
72 type Incomplete4
(<>); -- unknown discriminant
74 type Incomplete5
; -- no discriminant
76 type Incomplete6
(<>); -- unknown discriminant
78 type Incomplete1
(D1
: Enu_Type
) is tagged -- no discriminant/
79 record -- explicit discriminant
81 when M
=> MInteger
: Small_Int
:= 9;
82 when F
=> FInteger
: Small_Int
:= 8;
86 type Incomplete2
(D2
: Small_Int
) is new -- unknown discriminant/
87 Incomplete1
(D1
=> F
) with record -- explicit discriminant
88 ID
: String (1 .. D2
) := "ACVC95";
91 type Incomplete3
is new -- no discriminant/
92 NTag_Type
with record -- inherited discriminant
96 type Incomplete4
is new -- unknown discriminant/
97 NTag_Type
(D
=> 3) with record -- inherited discriminant
101 task type Incomplete5
(D5
: Enu_Type
) is -- no discriminant/
102 entry Read_Disc
(P
: out Enu_Type
); -- explicit discriminant
105 task type Incomplete6
106 (D6
: Small_Int
:= 4) is -- unknown discriminant/
107 entry Read_Int
(P
: out Small_Int
); -- explicit discriminant
112 --==================================================================--
114 package body C3A1002_0
is
116 task body Incomplete5
is
119 accept Read_Disc
(P
: out Enu_Type
) do
128 ----------------------------------------------------------------------
129 task body Incomplete6
is
132 accept Read_Int
(P
: out Small_Int
) do
143 --==================================================================--
152 Enum_Val
: Enu_Type
:= M
;
154 Int_Val
: Small_Int
:= 15;
156 -- Discriminant value comes from default.
158 Incomplete6_Obj_1
: Incomplete6
;
160 -- Discriminant value comes from explicit constraint.
162 Incomplete1_Obj_1
: Incomplete1
(M
);
164 Incomplete2_Obj_1
: Incomplete2
(6);
166 Incomplete5_Obj_1
: Incomplete5
(F
);
168 Incomplete6_Obj_2
: Incomplete6
(7);
170 -- Discriminant value comes from assignment.
172 Incomplete1_Obj_2
: Incomplete1
175 Incomplete3_Obj_1
: Incomplete3
176 := (D
=> 2, S
=> "Hi", I
=> 10, E
=> F
);
178 Incomplete4_Obj_1
: Incomplete4
179 := (E
=> M
, D
=> 3, S
=> "Bye", I
=> 14);
183 Report
.Test
("C3A1002", "Check that the full type completing a type " &
184 "with no discriminant part or an unknown discriminant " &
185 "part may have explicitly declared or inherited " &
186 "discriminants. Check for cases where the types are " &
187 "tagged records and task types");
189 -- Check the initial values.
191 if (Incomplete6_Obj_1
.D6
/= 4) then
192 Report
.Failed
("Wrong initial value for Incomplete6_Obj_1");
195 -- Check the explicit values.
197 if (Incomplete1_Obj_1
.D1
/= M
) or
198 (Incomplete1_Obj_1
.MInteger
/= 9) then
199 Report
.Failed
("Wrong values for Incomplete1_Obj_1");
202 if (Incomplete2_Obj_1
.D2
/= 6) or
203 (Incomplete2_Obj_1
.FInteger
/= 8) or
204 (Incomplete2_Obj_1
.ID
/= "ACVC95") then
205 Report
.Failed
("Wrong values for Incomplete2_Obj_1");
208 if (Incomplete5_Obj_1
.D5
/= F
) then
209 Report
.Failed
("Wrong value for Incomplete5_Obj_1");
212 Incomplete5_Obj_1
.Read_Disc
(Enum_Val
);
214 if (Enum_Val
/= F
) then
215 Report
.Failed
("Wrong value for Enum_Val");
218 if (Incomplete6_Obj_2
.D6
/= 7) then
219 Report
.Failed
("Wrong value for Incomplete6_Obj_2");
222 Incomplete6_Obj_1
.Read_Int
(Int_Val
);
224 if (Int_Val
/= 4) then
225 Report
.Failed
("Wrong value for Int_Val");
228 -- Check the assigned values.
230 if (Incomplete1_Obj_2
.D1
/= F
) or
231 (Incomplete1_Obj_2
.FInteger
/= 12) then
232 Report
.Failed
("Wrong values for Incomplete1_Obj_2");
235 if (Incomplete3_Obj_1
.D
/= 2 ) or
236 (Incomplete3_Obj_1
.I
/= 10) or
237 (Incomplete3_Obj_1
.E
/= F
) or
238 (Incomplete3_Obj_1
.S
/= "Hi") then
239 Report
.Failed
("Wrong values for Incomplete3_Obj_1");
242 if (Incomplete4_Obj_1
.E
/= M
) or
243 (Incomplete4_Obj_1
.D
/= 3) or
244 (Incomplete4_Obj_1
.S
/= "Bye") or
245 (Incomplete4_Obj_1
.I
/= 14) then
246 Report
.Failed
("Wrong values for Incomplete4_Obj_1");