Natools

Check-in [111a93ca40]
Login
Overview
Comment:reference_tests: also test the new Is_Last function
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 111a93ca401b4f2105464dc6b4923006c018bf83
User & Date: nat on 2014-08-25 19:57:12
Other Links: manifest | tags
Context
2014-08-26
20:50
references-pools: new package that provides a task-safe pool of references check-in: f530098004 user: nat tags: trunk
2014-08-25
19:57
reference_tests: also test the new Is_Last function check-in: 111a93ca40 user: nat tags: trunk
2014-08-24
20:31
references: add Is_Last primitive

It's almost a break in abstraction, and it's unsafe to use when the reference can be accessed concurrently. However it might have some use in some context, to free the last reference when checked in a protected or thread-local context, to build a crude garbage collection system. check-in: 610b834d9d user: nat tags: trunk

Changes

Modified tests/natools-reference_tests.adb from [24dd943433] to [2ff64e22d8].

144
145
146
147
148
149
150









151
152
153
154
155
156
157
         NT.Item (Report, Name, NT.Fail);
         NT.Info (Report,
           "Unexpected reference count"
           & Natural'Image (Actual_Count)
           & " instead of"
           & Natural'Image (Expected_Count));
         Continue := False;









      end if;
   end Check_Ref;



   --------------------
   -- Invidual tests --







>
>
>
>
>
>
>
>
>







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
         NT.Item (Report, Name, NT.Fail);
         NT.Info (Report,
           "Unexpected reference count"
           & Natural'Image (Actual_Count)
           & " instead of"
           & Natural'Image (Expected_Count));
         Continue := False;

      elsif not Ref.Is_Empty and then Ref.Is_Last /= (Actual_Count = 1) then
         NT.Item (Report, Name, NT.Fail);
         NT.Info (Report,
           "Unexpected result of Is_Last ("
           & Boolean'Image (Ref.Is_Last)
           & ") while counter is"
           & Natural'Image (Actual_Count));
         Continue := False;
      end if;
   end Check_Ref;



   --------------------
   -- Invidual tests --