Natools

Check-in [d1dd5bc62e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cron-tests: fix argument order in calls to Check
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d1dd5bc62edf0de462eef1b54e04aa9e91b96f3c
User & Date: nat 2017-07-06 20:51:46
Context
2017-07-07
20:11
cron-tests: add a test for event list extension by a single event check-in: 757553b10d user: nat tags: trunk
2017-07-06
20:51
cron-tests: fix argument order in calls to Check check-in: d1dd5bc62e user: nat tags: trunk
2017-07-05
20:57
s_expressions-parsers-tests: improve coverage of Close_Current_List check-in: b150b39643 user: nat tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/natools-cron-tests.adb.

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      --  Beat: set at 0.0, finalized at 4.5, run at 1.0, 2.0, 3.0, 4.0.
      --  Test_Entry: set at 0.5, reset at 4.0, run at 1.5, 2.5, 3.5.
      --  Beat: set at 4.5, finalized at 9.5, run at 5.0, 6.0, 7.0, 8.0, 9.0.
      --  Slow: set at 4.5, finalized at 9.5, run at 6.5, 8.5.
      --  Fast: set at 6.5, reset at 8.0,
      --        run at 6.7, 6.9, 7.1, 7.3, 7.5, 7.7, 7.9

      Check (Test, Get (Log), "o.1.1.1.|.O.sff.fffff.s.");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Basic_Usage;


   procedure Delete_While_Busy (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Delete entry while callback is running");







|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      --  Beat: set at 0.0, finalized at 4.5, run at 1.0, 2.0, 3.0, 4.0.
      --  Test_Entry: set at 0.5, reset at 4.0, run at 1.5, 2.5, 3.5.
      --  Beat: set at 4.5, finalized at 9.5, run at 5.0, 6.0, 7.0, 8.0, 9.0.
      --  Slow: set at 4.5, finalized at 9.5, run at 6.5, 8.5.
      --  Fast: set at 6.5, reset at 8.0,
      --        run at 6.7, 6.9, 7.1, 7.3, 7.5, 7.7, 7.9

      Check (Test, "o.1.1.1.|.O.sff.fffff.s.", Get (Log));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Basic_Usage;


   procedure Delete_While_Busy (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Delete entry while callback is running");
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
           (Backend => Log'Access,
            Open => '(',
            Close => ')',
            Wait => Total / 4));
         delay Total / 4;
      end;

      Check (Test, Get (Log), "(", "Before wait");
      delay Total / 2;
      Check (Test, Get (Log), "()", "After wait");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Delete_While_Busy;


   procedure Delete_While_Collision (Report : in out NT.Reporter'Class) is
      Test : NT.Test







|

|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
           (Backend => Log'Access,
            Open => '(',
            Close => ')',
            Wait => Total / 4));
         delay Total / 4;
      end;

      Check (Test, "(", Get (Log), "Before wait");
      delay Total / 2;
      Check (Test, "()", Get (Log), "After wait");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Delete_While_Busy;


   procedure Delete_While_Collision (Report : in out NT.Reporter'Class) is
      Test : NT.Test
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

      --  Timeline:  0  .  1/4  .  1/2  .  3/4  .   1   .  5/4
      --  Triggers:         *                               *
      --  Log:              (       )<      >               (
      --  End of Block:         ^
      --  End of Test:                          ^

      Check (Test, Get (Log), "(");
      delay 4 * Tick;
      Check (Test, Get (Log), "()<>");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Delete_While_Collision;


   procedure Event_List_Fusion (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Fusion of synchronized callbacks");







|

|







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

      --  Timeline:  0  .  1/4  .  1/2  .  3/4  .   1   .  5/4
      --  Triggers:         *                               *
      --  Log:              (       )<      >               (
      --  End of Block:         ^
      --  End of Test:                          ^

      Check (Test, "(", Get (Log));
      delay 4 * Tick;
      Check (Test, "()<>", Get (Log));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Delete_While_Collision;


   procedure Event_List_Fusion (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Fusion of synchronized callbacks");
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
285
286
287
288
            Close => ')',
            Wait => Total / 8));
         A_Tail.Set (First_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'A'));

         delay Total / 8 + Total / 16;
         Check (Test, Get (Log), "(");

         B_Head.Set (Second_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'B'));
         B_Tail.Set (Second_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'b'));

         delay Total / 4 + Total / 8;
         Check (Test, Get (Log), "()ABb()A");

         A_Tail.Reset;
         B_Tail.Reset;

         delay Total / 4;
         Check (Test, Get (Log), "()ABb()AB()");
      end;

      --  Timeline:  0   .   1/4   .   1/2   .   3/4   .   1
      --  Log:           (    )A  Bb(   )A   B(   )
      --  Code:      *     *               *         *   *

      delay Total / 8;
      Check (Test, Get (Log), "()ABb()AB()");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Event_List_Fusion;


   procedure Insert_While_Busy (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Insert entry while callback is running");







|









|





|







|







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
285
286
287
288
            Close => ')',
            Wait => Total / 8));
         A_Tail.Set (First_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'A'));

         delay Total / 8 + Total / 16;
         Check (Test, "(", Get (Log));

         B_Head.Set (Second_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'B'));
         B_Tail.Set (Second_Tick, Test_Callback'
           (Backend => Log'Access,
            Symbol => 'b'));

         delay Total / 4 + Total / 8;
         Check (Test, "()ABb()A", Get (Log));

         A_Tail.Reset;
         B_Tail.Reset;

         delay Total / 4;
         Check (Test, "()ABb()AB()", Get (Log));
      end;

      --  Timeline:  0   .   1/4   .   1/2   .   3/4   .   1
      --  Log:           (    )A  Bb(   )A   B(   )
      --  Code:      *     *               *         *   *

      delay Total / 8;
      Check (Test, "()ABb()AB()", Get (Log));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Event_List_Fusion;


   procedure Insert_While_Busy (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Insert entry while callback is running");
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
      --  Timeline: 0 . 1/8 . 1/4 .   3/8 . 1/2 .   5/8 . 3/4 . 7/8 . 1
      --  Set:      L       S
      --  Finalize:                                        *
      --  Ticks:         L     L  S    L  S  L  S    L  S  L
      --  Run:           <----L---->S  <----L---->S  <----L---->

      delay Total / 8;
      Check (Test, Get (Log), "().().()");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Insert_While_Busy;


   procedure Time_Collision (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Simultaneous activation of events");







|







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
      --  Timeline: 0 . 1/8 . 1/4 .   3/8 . 1/2 .   5/8 . 3/4 . 7/8 . 1
      --  Set:      L       S
      --  Finalize:                                        *
      --  Ticks:         L     L  S    L  S  L  S    L  S  L
      --  Run:           <----L---->S  <----L---->S  <----L---->

      delay Total / 8;
      Check (Test, "().().()", Get (Log));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Insert_While_Busy;


   procedure Time_Collision (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Simultaneous activation of events");
339
340
341
342
343
344
345
346
347
348
349
350
351
           (Common, Test_Callback'(Backend => Log'Access, Symbol => '2'));
         Third.Set
           ((Origin => Common.Origin, Period => 2 * Common.Period),
            Test_Callback'(Backend => Log'Access, Symbol => '3'));
         delay Total - Tick / 2;
      end;

      Check (Test, Get (Log), "12312123");
   exception
      when Error : others => Test.Report_Exception (Error);
   end Time_Collision;

end Natools.Cron.Tests;







|





339
340
341
342
343
344
345
346
347
348
349
350
351
           (Common, Test_Callback'(Backend => Log'Access, Symbol => '2'));
         Third.Set
           ((Origin => Common.Origin, Period => 2 * Common.Period),
            Test_Callback'(Backend => Log'Access, Symbol => '3'));
         delay Total - Tick / 2;
      end;

      Check (Test, "12312123", Get (Log));
   exception
      when Error : others => Test.Report_Exception (Error);
   end Time_Collision;

end Natools.Cron.Tests;