@@ -521,78 +521,78 @@ void event_period_tests()
521
521
// Test a non periodic event ie dispatched only once
522
522
523
523
Event<void ()> event1 (&period_tests_queue, handler);
524
-
524
+
525
525
event1.delay (10ms);
526
526
event1.period (events::non_periodic);
527
527
event1.post ();
528
528
529
- period_tests_queue.dispatch (80 );
530
-
529
+ period_tests_queue.dispatch (80 );
530
+
531
531
// Wait 100ms and check the event execution status
532
- wait_us (100 * 1000 );
533
-
534
- // Event should only have been dispatched once and thus counter
532
+ wait_us (100 * 1000 );
533
+
534
+ // Event should only have been dispatched once and thus counter
535
535
// should be 1
536
536
TEST_ASSERT_EQUAL (1 , update_counter);
537
537
538
538
// Test an event with an invalid negative period value.
539
-
539
+
540
540
update_counter = 0 ;
541
-
541
+
542
542
Event<void ()> event2 (&period_tests_queue, handler);
543
-
543
+
544
544
event2.delay (10ms);
545
545
event2.period (-10ms);
546
546
event2.post ();
547
547
548
- period_tests_queue.dispatch (80 );
549
-
548
+ period_tests_queue.dispatch (80 );
549
+
550
550
// Wait 100ms and check the event execution status
551
- wait_us (100 * 1000 );
552
-
553
- // Event should default to non_periodic and thus only have been
551
+ wait_us (100 * 1000 );
552
+
553
+ // Event should default to non_periodic and thus only have been
554
554
// dispatched once. Counter should be 1.
555
555
TEST_ASSERT_EQUAL (1 , update_counter);
556
556
557
557
// Test an event with a zero period.
558
-
558
+
559
559
update_counter = 0 ;
560
-
560
+
561
561
Event<void ()> event3 (&period_tests_queue, handler);
562
-
562
+
563
563
event3.delay (10ms);
564
564
event3.period (0ms);
565
565
event3.post ();
566
566
567
- period_tests_queue.dispatch (80 );
568
-
567
+ period_tests_queue.dispatch (80 );
568
+
569
569
// Wait 100ms and check the event execution status
570
- wait_us (100 * 1000 );
571
-
572
- // Event should default to non_periodic and thus only have been
570
+ wait_us (100 * 1000 );
571
+
572
+ // Event should default to non_periodic and thus only have been
573
573
// dispatched once. Counter should be 1.
574
574
TEST_ASSERT_EQUAL (1 , update_counter);
575
575
576
576
// Test a periodic event ie dispatched a number of times
577
577
update_counter = 0 ;
578
-
578
+
579
579
Event<void ()> event4 (&period_tests_queue, handler);
580
-
580
+
581
581
event4.delay (10ms);
582
- event4.period (20ms);
582
+ event4.period (20ms);
583
583
event4.post ();
584
584
585
- period_tests_queue.dispatch (80 );
586
-
585
+ period_tests_queue.dispatch (80 );
586
+
587
587
// Wait 100ms and check the event execution status
588
- wait_us (100 * 1000 );
589
-
588
+ wait_us (100 * 1000 );
589
+
590
590
// The event should be first dispatched after 10ms and then
591
591
// every subsequent 20ms until the dispatcher has completed.
592
592
// Thus the counter should be incremented after :
593
593
// 10ms, 30ms, 50ms and 70ms
594
594
TEST_ASSERT_EQUAL (4 , update_counter);
595
-
595
+
596
596
}
597
597
598
598
// Test setup
0 commit comments