Natools

Diff
Login

Differences From Artifact [a304628ce9]:

To Artifact [f6e23bd423]:


53
54
55
56
57
58
59







60
61
62
63
64
65
66
   function Factory return Counter is
   begin
      Instance_Count := Instance_Count + 1;
      return Counter'(Ada.Finalization.Limited_Controlled with
         Instance_Number => Instance_Count);
   end Factory;









   overriding procedure Finalize (Object : in out Counter) is
      pragma Unreferenced (Object);
   begin
      Instance_Count := Instance_Count - 1;
   end Finalize;








>
>
>
>
>
>
>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
   function Factory return Counter is
   begin
      Instance_Count := Instance_Count + 1;
      return Counter'(Ada.Finalization.Limited_Controlled with
         Instance_Number => Instance_Count);
   end Factory;


   overriding procedure Initialize (Object : in out Counter) is
   begin
      Instance_Count := Instance_Count + 1;
      Object.Instance_Number := Instance_Count;
   end Initialize;


   overriding procedure Finalize (Object : in out Counter) is
      pragma Unreferenced (Object);
   begin
      Instance_Count := Instance_Count - 1;
   end Finalize;

228
229
230
231
232
233
234

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
      Initial_Count : constant Integer := Instance_Count;
      Continue : Boolean := True;
   begin
      declare
         procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer);

         Ref_0 : Refs.Reference := Refs.Create (Factory'Access);

         Ref_1, Ref_2 : Refs.Reference;

         procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer) is
         begin
            Check_Ref (Report, Name, Ref_0, Count_0, Continue);
            Check_Ref (Report, Name, Ref_1, Count_1, Continue);
            Check_Ref (Report, Name, Ref_2, Count_2, Continue);
            Check_Consistency (Report, Name, Ref_0, Ref_1, Continue);
            Check_Consistency (Report, Name, Ref_1, Ref_2, Continue);
            Check_Consistency (Report, Name, Ref_2, Ref_0, Continue);
            Check_Count (Report, Name, Initial_Count + Delta_I, Continue);
         end Check;
      begin
         Check (1, 0, 0, 1);

         if Continue then
            Ref_1 := Refs.Create (Factory'Access);
         end if;

         Check (1, 1, 0, 2);

         if Continue then
            Ref_2 := Ref_0;
         end if;

         Check (2, 1, 2, 2);

         if Continue then
            Ref_1 := Ref_0;
         end if;

         Check (3, 3, 3, 1);

         if Continue then
            Ref_2.Replace (Factory'Access);
         end if;

         Check (2, 2, 1, 2);

         if Continue then
            Ref_1.Reset;
            Ref_0 := Ref_1;







>
|















|

















|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
      Initial_Count : constant Integer := Instance_Count;
      Continue : Boolean := True;
   begin
      declare
         procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer);

         Ref_0 : Refs.Reference := Refs.Create (Factory'Access);
         Ref_1 : Refs.Reference := Refs.Create (Refs.Data_Access'(null));
         Ref_2 : Refs.Reference;

         procedure Check (Count_0, Count_1, Count_2, Delta_I : in Integer) is
         begin
            Check_Ref (Report, Name, Ref_0, Count_0, Continue);
            Check_Ref (Report, Name, Ref_1, Count_1, Continue);
            Check_Ref (Report, Name, Ref_2, Count_2, Continue);
            Check_Consistency (Report, Name, Ref_0, Ref_1, Continue);
            Check_Consistency (Report, Name, Ref_1, Ref_2, Continue);
            Check_Consistency (Report, Name, Ref_2, Ref_0, Continue);
            Check_Count (Report, Name, Initial_Count + Delta_I, Continue);
         end Check;
      begin
         Check (1, 0, 0, 1);

         if Continue then
            Ref_1 := Refs.Create (new Counter);
         end if;

         Check (1, 1, 0, 2);

         if Continue then
            Ref_2 := Ref_0;
         end if;

         Check (2, 1, 2, 2);

         if Continue then
            Ref_1 := Ref_0;
         end if;

         Check (3, 3, 3, 1);

         if Continue then
            Ref_2.Replace (new Counter);
         end if;

         Check (2, 2, 1, 2);

         if Continue then
            Ref_1.Reset;
            Ref_0 := Ref_1;