annotate gcc/testsuite/ada/acats/tests/c7/c760001.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C760001.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that Initialize is called for objects and components of
kono
parents:
diff changeset
28 -- a controlled type when the objects and components are not
kono
parents:
diff changeset
29 -- assigned explicit initial values. Check this for "simple" controlled
kono
parents:
diff changeset
30 -- objects, controlled record components and arrays with controlled
kono
parents:
diff changeset
31 -- components.
kono
parents:
diff changeset
32 --
kono
parents:
diff changeset
33 -- Check that if an explicit initial value is assigned to an object
kono
parents:
diff changeset
34 -- or component of a controlled type then Initialize is not called.
kono
parents:
diff changeset
35 --
kono
parents:
diff changeset
36 -- TEST DESCRIPTION:
kono
parents:
diff changeset
37 -- This test derives a type for Ada.Finalization.Controlled, and
kono
parents:
diff changeset
38 -- overrides the Initialize and Adjust operations for the type. The
kono
parents:
diff changeset
39 -- intent of the type is that it should carry incremental values
kono
parents:
diff changeset
40 -- indicating the ordering of events with respect to these (and default
kono
parents:
diff changeset
41 -- initialization) operations. The body of the test uses these values
kono
parents:
diff changeset
42 -- to determine that the implicit calls to these subprograms happen
kono
parents:
diff changeset
43 -- (or don't) at the appropriate times.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 -- The test further derives types from this "root" type, which are the
kono
parents:
diff changeset
46 -- actual types used in the test. One of the types is "simply" derived
kono
parents:
diff changeset
47 -- from the "root" type, the other contains a component of the first
kono
parents:
diff changeset
48 -- type, thus nesting a controlled object as a record component in
kono
parents:
diff changeset
49 -- controlled objects.
kono
parents:
diff changeset
50 --
kono
parents:
diff changeset
51 -- The main program declares objects of these types and checks the
kono
parents:
diff changeset
52 -- values of the components to ascertain that they have been touched
kono
parents:
diff changeset
53 -- as expected.
kono
parents:
diff changeset
54 --
kono
parents:
diff changeset
55 -- Note that Finalization procedures are provided. This test does not
kono
parents:
diff changeset
56 -- test that the calls to Finalization are made correctly. The
kono
parents:
diff changeset
57 -- Finalization procedures are provided to catch an implementation that
kono
parents:
diff changeset
58 -- calls Finalization at an incorrect time.
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 --
kono
parents:
diff changeset
61 -- CHANGE HISTORY:
kono
parents:
diff changeset
62 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
63 -- 10 Oct 95 SAIC Update and repair for ACVC 2.0.1
kono
parents:
diff changeset
64 --
kono
parents:
diff changeset
65 --!
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 ---------------------------------------------------------------- C760001_0
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 with Ada.Finalization;
kono
parents:
diff changeset
70 package C760001_0 is
kono
parents:
diff changeset
71 subtype Unique_ID is Natural;
kono
parents:
diff changeset
72 function Unique_Value return Unique_ID;
kono
parents:
diff changeset
73 -- increments each time it's called
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 function Most_Recent_Unique_Value return Unique_ID;
kono
parents:
diff changeset
76 -- returns the same value as the most recent call to Unique_Value
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 type Root_Controlled is new Ada.Finalization.Controlled with record
kono
parents:
diff changeset
79 My_ID : Unique_ID := Unique_Value;
kono
parents:
diff changeset
80 My_Init_ID : Unique_ID := Unique_ID'First;
kono
parents:
diff changeset
81 My_Adj_ID : Unique_ID := Unique_ID'First;
kono
parents:
diff changeset
82 end record;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 procedure Initialize( R: in out Root_Controlled );
kono
parents:
diff changeset
85 procedure Adjust ( R: in out Root_Controlled );
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 TC_Initialize_Calls_Is_Failing : Boolean := False;
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 end C760001_0;
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 with Report;
kono
parents:
diff changeset
94 package body C760001_0 is
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 Global_Unique_Counter : Unique_ID := 0;
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 function Unique_Value return Unique_ID is
kono
parents:
diff changeset
99 begin
kono
parents:
diff changeset
100 Global_Unique_Counter := Global_Unique_Counter +1;
kono
parents:
diff changeset
101 return Global_Unique_Counter;
kono
parents:
diff changeset
102 end Unique_Value;
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 function Most_Recent_Unique_Value return Unique_ID is
kono
parents:
diff changeset
105 begin
kono
parents:
diff changeset
106 return Global_Unique_Counter;
kono
parents:
diff changeset
107 end Most_Recent_Unique_Value;
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 procedure Initialize( R: in out Root_Controlled ) is
kono
parents:
diff changeset
110 begin
kono
parents:
diff changeset
111 if TC_Initialize_Calls_Is_Failing then
kono
parents:
diff changeset
112 Report.Failed("Initialized incorrectly called");
kono
parents:
diff changeset
113 end if;
kono
parents:
diff changeset
114 R.My_Init_ID := Unique_Value;
kono
parents:
diff changeset
115 end Initialize;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 procedure Adjust( R: in out Root_Controlled ) is
kono
parents:
diff changeset
118 begin
kono
parents:
diff changeset
119 R.My_Adj_ID := Unique_Value;
kono
parents:
diff changeset
120 end Adjust;
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 end C760001_0;
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 ---------------------------------------------------------------- C760001_1
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 with Ada.Finalization;
kono
parents:
diff changeset
127 with C760001_0;
kono
parents:
diff changeset
128 package C760001_1 is
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 type Proc_ID is (None, Init, Adj, Fin);
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 type Test_Controlled is new C760001_0.Root_Controlled with record
kono
parents:
diff changeset
133 Last_Proc_Called: Proc_ID := None;
kono
parents:
diff changeset
134 end record;
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 procedure Initialize( TC: in out Test_Controlled );
kono
parents:
diff changeset
137 procedure Adjust ( TC: in out Test_Controlled );
kono
parents:
diff changeset
138 procedure Finalize ( TC: in out Test_Controlled );
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 type Nested_Controlled is new C760001_0.Root_Controlled with record
kono
parents:
diff changeset
141 Nested : C760001_0.Root_Controlled;
kono
parents:
diff changeset
142 Last_Proc_Called: Proc_ID := None;
kono
parents:
diff changeset
143 end record;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 procedure Initialize( TC: in out Nested_Controlled );
kono
parents:
diff changeset
146 procedure Adjust ( TC: in out Nested_Controlled );
kono
parents:
diff changeset
147 procedure Finalize ( TC: in out Nested_Controlled );
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 end C760001_1;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 with Report;
kono
parents:
diff changeset
154 package body C760001_1 is
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 procedure Initialize( TC: in out Test_Controlled ) is
kono
parents:
diff changeset
157 begin
kono
parents:
diff changeset
158 if TC.Last_Proc_Called /= None then
kono
parents:
diff changeset
159 Report.Failed("Initialize for Test_Controlled");
kono
parents:
diff changeset
160 end if;
kono
parents:
diff changeset
161 TC.Last_Proc_Called := Init;
kono
parents:
diff changeset
162 C760001_0.Initialize(C760001_0.Root_Controlled(TC));
kono
parents:
diff changeset
163 end Initialize;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 procedure Adjust ( TC: in out Test_Controlled ) is
kono
parents:
diff changeset
166 begin
kono
parents:
diff changeset
167 TC.Last_Proc_Called := Adj;
kono
parents:
diff changeset
168 C760001_0.Adjust(C760001_0.Root_Controlled(TC));
kono
parents:
diff changeset
169 end Adjust;
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 procedure Finalize ( TC: in out Test_Controlled ) is
kono
parents:
diff changeset
172 begin
kono
parents:
diff changeset
173 TC.Last_Proc_Called := Fin;
kono
parents:
diff changeset
174 end Finalize;
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 procedure Initialize( TC: in out Nested_Controlled ) is
kono
parents:
diff changeset
177 begin
kono
parents:
diff changeset
178 if TC.Last_Proc_Called /= None then
kono
parents:
diff changeset
179 Report.Failed("Initialize for Nested_Controlled");
kono
parents:
diff changeset
180 end if;
kono
parents:
diff changeset
181 TC.Last_Proc_Called := Init;
kono
parents:
diff changeset
182 C760001_0.Initialize(C760001_0.Root_Controlled(TC));
kono
parents:
diff changeset
183 end Initialize;
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 procedure Adjust ( TC: in out Nested_Controlled ) is
kono
parents:
diff changeset
186 begin
kono
parents:
diff changeset
187 TC.Last_Proc_Called := Adj;
kono
parents:
diff changeset
188 C760001_0.Adjust(C760001_0.Root_Controlled(TC));
kono
parents:
diff changeset
189 end Adjust;
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 procedure Finalize ( TC: in out Nested_Controlled ) is
kono
parents:
diff changeset
192 begin
kono
parents:
diff changeset
193 TC.Last_Proc_Called := Fin;
kono
parents:
diff changeset
194 end Finalize;
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 end C760001_1;
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 ---------------------------------------------------------------- C760001
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 with Report;
kono
parents:
diff changeset
201 with TCTouch;
kono
parents:
diff changeset
202 with C760001_0;
kono
parents:
diff changeset
203 with C760001_1;
kono
parents:
diff changeset
204 with Ada.Finalization;
kono
parents:
diff changeset
205 procedure C760001 is
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 use type C760001_1.Proc_ID;
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 -- in the first test, test the simple case. Check that a controlled object
kono
parents:
diff changeset
210 -- causes a call to the procedure Initialize.
kono
parents:
diff changeset
211 -- Also check that assignment causes a call to Adjust.
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 procedure Check_Simple_Objects is
kono
parents:
diff changeset
214 S,T : C760001_1.Test_Controlled;
kono
parents:
diff changeset
215 begin
kono
parents:
diff changeset
216 TCTouch.Assert(S.My_ID < S.My_Init_ID,"Default before dispatch");
kono
parents:
diff changeset
217 TCTouch.Assert((S.Last_Proc_Called = C760001_1.Init) and
kono
parents:
diff changeset
218 (T.Last_Proc_Called = C760001_1.Init),
kono
parents:
diff changeset
219 "Initialize for simple object");
kono
parents:
diff changeset
220 S := T;
kono
parents:
diff changeset
221 TCTouch.Assert((S.Last_Proc_Called = C760001_1.Adj),
kono
parents:
diff changeset
222 "Adjust for simple object");
kono
parents:
diff changeset
223 TCTouch.Assert((S.My_ID = T.My_ID),
kono
parents:
diff changeset
224 "Simple object My_ID's don't match");
kono
parents:
diff changeset
225 TCTouch.Assert((S.My_Init_ID = T.My_Init_ID),
kono
parents:
diff changeset
226 "Simple object My_Init_ID's don't match");
kono
parents:
diff changeset
227 TCTouch.Assert((S.My_Adj_ID > T.My_Adj_ID),
kono
parents:
diff changeset
228 "Simple object My_Adj_ID's in wrong order");
kono
parents:
diff changeset
229 end Check_Simple_Objects;
kono
parents:
diff changeset
230
kono
parents:
diff changeset
231 -- in the second test, test a more complex case, check that a controlled
kono
parents:
diff changeset
232 -- component of a controlled object gets processed correctly
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 procedure Check_Nested_Objects is
kono
parents:
diff changeset
235 NO1 : C760001_1.Nested_Controlled;
kono
parents:
diff changeset
236 begin
kono
parents:
diff changeset
237 TCTouch.Assert((NO1.My_ID < NO1.My_Init_Id),
kono
parents:
diff changeset
238 "Default value order incorrect");
kono
parents:
diff changeset
239 TCTouch.Assert((NO1.My_Init_Id > NO1.Nested.My_Init_ID),
kono
parents:
diff changeset
240 "Initialization call order incorrect");
kono
parents:
diff changeset
241 end Check_Nested_Objects;
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 -- check that objects assigned an initial value at declaration are Adjusted
kono
parents:
diff changeset
244 -- and NOT Initialized
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 procedure Check_Objects_With_Initial_Values is
kono
parents:
diff changeset
247
kono
parents:
diff changeset
248 TC_Now : constant C760001_0.Unique_ID := C760001_0.Unique_Value;
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 A: C760001_1.Test_Controlled :=
kono
parents:
diff changeset
251 ( Ada.Finalization.Controlled
kono
parents:
diff changeset
252 with TC_Now,
kono
parents:
diff changeset
253 TC_Now,
kono
parents:
diff changeset
254 TC_Now,
kono
parents:
diff changeset
255 C760001_1.None);
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 B: C760001_1.Nested_Controlled :=
kono
parents:
diff changeset
258 ( Ada.Finalization.Controlled
kono
parents:
diff changeset
259 with TC_Now,
kono
parents:
diff changeset
260 TC_Now,
kono
parents:
diff changeset
261 TC_Now,
kono
parents:
diff changeset
262 C760001_0.Root_Controlled(A),
kono
parents:
diff changeset
263 C760001_1.None);
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 begin
kono
parents:
diff changeset
266 -- the implementation may or may not call Adjust for the values
kono
parents:
diff changeset
267 -- assigned into A and B,
kono
parents:
diff changeset
268 -- but should NOT call Initialize.
kono
parents:
diff changeset
269 -- if the value used in the aggregate is overwritten by Initialize,
kono
parents:
diff changeset
270 -- this indicates failure
kono
parents:
diff changeset
271 TCTouch.Assert(A.My_Init_Id = TC_Now,
kono
parents:
diff changeset
272 "Initialize was called for A with initial value");
kono
parents:
diff changeset
273 TCTouch.Assert(B.My_Init_Id = TC_Now,
kono
parents:
diff changeset
274 "Initialize was called for B with initial value");
kono
parents:
diff changeset
275 TCTouch.Assert(B.Nested.My_Init_ID = TC_Now,
kono
parents:
diff changeset
276 "Initialize was called for B.Nested initial value");
kono
parents:
diff changeset
277 end Check_Objects_With_Initial_Values;
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 procedure Check_Array_Case is
kono
parents:
diff changeset
280 type Array_Simple is array(1..4) of C760001_1.Test_Controlled;
kono
parents:
diff changeset
281 type Array_Nested is array(1..4) of C760001_1.Nested_Controlled;
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 Simple_Array_Default : Array_Simple;
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 Nested_Array_Default : Array_Nested;
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 TC_A_Bit_Later : C760001_0.Unique_ID;
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 begin
kono
parents:
diff changeset
290 TC_A_Bit_Later := C760001_0.Unique_Value;
kono
parents:
diff changeset
291 for N in 1..4 loop
kono
parents:
diff changeset
292 TCTouch.Assert(Simple_Array_Default(N).Last_Proc_Called
kono
parents:
diff changeset
293 = C760001_1.Init,
kono
parents:
diff changeset
294 "Initialize for array initial value");
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 TCTouch.Assert( (Simple_Array_Default(N).My_Init_ID
kono
parents:
diff changeset
297 > C760001_0.Unique_ID'First)
kono
parents:
diff changeset
298 and (Simple_Array_Default(N).My_Init_ID
kono
parents:
diff changeset
299 < TC_A_Bit_Later),
kono
parents:
diff changeset
300 "Initialize timing for simple array");
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 TCTouch.Assert( (Nested_Array_Default(N).My_Init_ID
kono
parents:
diff changeset
303 > C760001_0.Unique_ID'First)
kono
parents:
diff changeset
304 and (Nested_Array_Default(N).My_Init_ID
kono
parents:
diff changeset
305 < TC_A_Bit_Later),
kono
parents:
diff changeset
306 "Initialize timing for container array");
kono
parents:
diff changeset
307
kono
parents:
diff changeset
308 TCTouch.Assert(Nested_Array_Default(N).Last_Proc_Called
kono
parents:
diff changeset
309 = C760001_1.Init,
kono
parents:
diff changeset
310 "Initialize for nested array (outer) initial value");
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 TCTouch.Assert( (Nested_Array_Default(N).Nested.My_Init_ID
kono
parents:
diff changeset
313 > C760001_0.Unique_ID'First)
kono
parents:
diff changeset
314 and (Nested_Array_Default(N).Nested.My_Init_ID
kono
parents:
diff changeset
315 < Nested_Array_Default(N).My_Init_ID),
kono
parents:
diff changeset
316 "Initialize timing for array content");
kono
parents:
diff changeset
317 end loop;
kono
parents:
diff changeset
318 end Check_Array_Case;
kono
parents:
diff changeset
319
kono
parents:
diff changeset
320 procedure Check_Array_Case_With_Initial_Values is
kono
parents:
diff changeset
321
kono
parents:
diff changeset
322 TC_Now : constant C760001_0.Unique_ID := C760001_0.Unique_Value;
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 type Array_Simple is array(1..4) of C760001_1.Test_Controlled;
kono
parents:
diff changeset
325 type Array_Nested is array(1..4) of C760001_1.Nested_Controlled;
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 Simple_Array_Explicit : Array_Simple := ( 1..4 => (
kono
parents:
diff changeset
328 Ada.Finalization.Controlled
kono
parents:
diff changeset
329 with TC_Now,
kono
parents:
diff changeset
330 TC_Now,
kono
parents:
diff changeset
331 TC_Now,
kono
parents:
diff changeset
332 C760001_1.None ) );
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 A : constant C760001_0.Root_Controlled :=
kono
parents:
diff changeset
335 ( Ada.Finalization.Controlled
kono
parents:
diff changeset
336 with others => TC_Now);
kono
parents:
diff changeset
337
kono
parents:
diff changeset
338 Nested_Array_Explicit : Array_Nested := ( 1..4 => (
kono
parents:
diff changeset
339 Ada.Finalization.Controlled
kono
parents:
diff changeset
340 with TC_Now,
kono
parents:
diff changeset
341 TC_Now,
kono
parents:
diff changeset
342 TC_Now,
kono
parents:
diff changeset
343 A,
kono
parents:
diff changeset
344 C760001_1.None ) );
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 begin
kono
parents:
diff changeset
347 -- the implementation may or may not call Adjust for the values
kono
parents:
diff changeset
348 -- assigned into Simple_Array_Explicit and Nested_Array_Explicit,
kono
parents:
diff changeset
349 -- but should NOT call Initialize.
kono
parents:
diff changeset
350 -- if the value used in the aggregate is overwritten by Initialize,
kono
parents:
diff changeset
351 -- this indicates failure
kono
parents:
diff changeset
352 for N in 1..4 loop
kono
parents:
diff changeset
353 TCTouch.Assert(Simple_Array_Explicit(N).My_Init_ID
kono
parents:
diff changeset
354 = TC_Now,
kono
parents:
diff changeset
355 "Initialize was called for array with initial value");
kono
parents:
diff changeset
356 TCTouch.Assert(Nested_Array_Explicit(N).My_Init_ID
kono
parents:
diff changeset
357 = TC_Now,
kono
parents:
diff changeset
358 "Initialize was called for nested array (outer) with initial value");
kono
parents:
diff changeset
359 TCTouch.Assert(Nested_Array_Explicit(N).Nested.My_Init_ID = TC_Now,
kono
parents:
diff changeset
360 "Initialize was called for nested array (inner) with initial value");
kono
parents:
diff changeset
361 end loop;
kono
parents:
diff changeset
362 end Check_Array_Case_With_Initial_Values;
kono
parents:
diff changeset
363
kono
parents:
diff changeset
364 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
kono
parents:
diff changeset
365
kono
parents:
diff changeset
366 begin -- Main test procedure.
kono
parents:
diff changeset
367
kono
parents:
diff changeset
368 Report.Test ("C760001", "Check that Initialize is called for objects " &
kono
parents:
diff changeset
369 "and components of a controlled type when the " &
kono
parents:
diff changeset
370 "objects and components are not assigned " &
kono
parents:
diff changeset
371 "explicit initial values. Check that if an " &
kono
parents:
diff changeset
372 "explicit initial value is assigned to an " &
kono
parents:
diff changeset
373 "object or component of a controlled type " &
kono
parents:
diff changeset
374 "then Initialize is not called" );
kono
parents:
diff changeset
375
kono
parents:
diff changeset
376 Check_Simple_Objects;
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 Check_Nested_Objects;
kono
parents:
diff changeset
379
kono
parents:
diff changeset
380 Check_Array_Case;
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 C760001_0.TC_Initialize_Calls_Is_Failing := True;
kono
parents:
diff changeset
383
kono
parents:
diff changeset
384 Check_Objects_With_Initial_Values;
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 Check_Array_Case_With_Initial_Values;
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388 Report.Result;
kono
parents:
diff changeset
389
kono
parents:
diff changeset
390 end C760001;