@@ -47,7 +47,7 @@ void wait_util (std::chrono::milliseconds ms, wk_guard& wg, std::thread& thr) {
4747template <typename Clock>
4848void test_util () {
4949
50- GIVEN ( " A clock and a duration" ) {
50+ SECTION ( " Setup clock and duration" ) {
5151
5252 asio::io_context ioc;
5353 chops::periodic_timer<Clock> timer {ioc};
@@ -56,7 +56,7 @@ void test_util () {
5656 std::thread thr ([&ioc] () { ioc.run (); } );
5757 count = 0 ;
5858
59- WHEN ( " The duration is 100 ms" ) {
59+ SECTION ( " 100 ms duration " ) {
6060 auto test_dur { 100 };
6161 timer.start_duration_timer (std::chrono::milliseconds (test_dur),
6262 [] (std::error_code err, typename Clock::duration elap) {
@@ -66,11 +66,9 @@ void test_util () {
6666
6767 wait_util (std::chrono::milliseconds ((Expected+1 )*test_dur), wg, thr);
6868
69- THEN ( " the timer callback count should match expected" ) {
70- REQUIRE (count == Expected);
71- }
69+ REQUIRE (count == Expected);
7270 }
73- WHEN ( " The duration is 200 ms and the start time is 2 seconds in the future" ) {
71+ SECTION ( " 200 ms duration, start time is 2 seconds in the future" ) {
7472 auto test_dur { 200 };
7573 timer.start_duration_timer (std::chrono::milliseconds (test_dur), Clock::now () + std::chrono::seconds (2 ),
7674 [] (std::error_code err, typename Clock::duration elap) {
@@ -80,11 +78,9 @@ void test_util () {
8078
8179 wait_util (std::chrono::milliseconds ((Expected+1 )*test_dur + 2000 ), wg, thr);
8280
83- THEN ( " the timer callback count should match expected" ) {
84- REQUIRE (count == Expected);
85- }
81+ REQUIRE (count == Expected);
8682 }
87- WHEN ( " The duration is 100 ms and the timer pops on timepoints" ) {
83+ SECTION ( " 100 ms duration, timer pops on timepoints" ) {
8884 auto test_dur { 100 };
8985 timer.start_timepoint_timer (std::chrono::milliseconds (test_dur),
9086 [] (std::error_code err, typename Clock::duration elap) {
@@ -94,11 +90,9 @@ void test_util () {
9490
9591 wait_util (std::chrono::milliseconds ((Expected+1 )*test_dur), wg, thr);
9692
97- THEN ( " the timer callback count should match expected" ) {
98- REQUIRE (count == Expected);
99- }
93+ REQUIRE (count == Expected);
10094 }
101- WHEN ( " The duration is 200 ms and the timer pops on timepoints starting 2 seconds in the future" ) {
95+ SECTION ( " 200 ms duration, timer pops on timepoints starting 2 seconds in the future" ) {
10296 auto test_dur { 200 };
10397 timer.start_timepoint_timer (std::chrono::milliseconds (test_dur), Clock::now () + std::chrono::seconds (2 ),
10498 [] (std::error_code err, typename Clock::duration elap) {
@@ -108,25 +102,23 @@ void test_util () {
108102
109103 wait_util (std::chrono::milliseconds ((Expected+1 )*test_dur + 2000 ), wg, thr);
110104
111- THEN ( " the timer callback count should match expected" ) {
112- REQUIRE (count == Expected);
113- }
105+ REQUIRE (count == Expected);
114106 }
115107
116- } // end given
108+ }
117109}
118110
119- SCENARIO ( " A periodic timer can be instantiated on the steady clock " , " [periodic_timer] [steady_clock]" ) {
111+ TEST_CASE ( " Steady clock periodic timer" , " [periodic_timer] [steady_clock]" ) {
120112
121113 test_util<std::chrono::steady_clock>();
122114
123115}
124- SCENARIO ( " A periodic timer can be instantiated on the system clock " , " [periodic_timer] [system_clock]" ) {
116+ TEST_CASE ( " System clock periodic timer" , " [periodic_timer] [system_clock]" ) {
125117
126118 test_util<std::chrono::system_clock>();
127119
128120}
129- SCENARIO ( " A periodic timer can be instantiated on the high resolution clock" , " [periodic_timer] [high_resolution_clock]" ) {
121+ TEST_CASE ( " High resolution clock periodic timer " , " [periodic_timer] [high_resolution_clock]" ) {
130122
131123 test_util<std::chrono::high_resolution_clock>();
132124
0 commit comments