11
2- #include < AUnit .h>
2+ #include < testing/SimpleTest .h>
33#include < ExecWithParameter.h>
44#include " TaskManagerIO.h"
55#include " test_utils.h"
66
7- using namespace aunit ;
7+ using namespace SimpleTest ;
88
99void dumpTasks () {
1010 Serial.println (" Dumping the task queue contents" );
@@ -57,10 +57,10 @@ class TestingExec : public Executable {
5757TestingExec exec;
5858
5959testF (TimingHelpFixture, testRunningUsingExecutorClass) {
60- taskManager.scheduleFixedRate (10 , &exec);
60+ taskManager.scheduleFixedRate (10 , &:: exec);
6161 taskManager.scheduleOnce (250 , recordingJob);
6262 assertThatTaskRunsOnTime (250000L , MILLIS_ALLOWANCE);
63- assertMore ( exec.noOfTimesRun , 10 );
63+ assertMoreThan ( 10 , :: exec.noOfTimesRun );
6464}
6565
6666testF (TimingHelpFixture, schedulingTaskOnceInMicroseconds) {
@@ -96,7 +96,7 @@ testF(TimingHelpFixture, enableAndDisableSupport) {
9696 static int myTaskCounter = 0 ;
9797 auto myTaskId = taskManager.scheduleFixedRate (1 , [] { myTaskCounter++; }, TIME_MILLIS);
9898 taskManager.yieldForMicros (20000 );
99- assertNotEqual (0 , myTaskCounter);
99+ assertNotEquals (0 , myTaskCounter);
100100
101101 // "turn off" the task
102102 taskManager.setTaskEnabled (myTaskId, false );
@@ -107,32 +107,32 @@ testF(TimingHelpFixture, enableAndDisableSupport) {
107107
108108 // now run the task for some time, it should never get scheduled.
109109 taskManager.yieldForMicros (20000 );
110- assertEqual (myTaskCounter, oldTaskCount);
110+ assertEquals (myTaskCounter, oldTaskCount);
111111
112112 // "turn on" the task and see if it increases again
113113 taskManager.setTaskEnabled (myTaskId, true );
114114 taskManager.yieldForMicros (20000 );
115- assertNotEqual (myTaskCounter, oldTaskCount);
115+ assertNotEquals (myTaskCounter, oldTaskCount);
116116
117117}
118118
119119testF (TimingHelpFixture, scheduleFixedRateTestCase) {
120- assertEqual (taskManager.getFirstTask (), NULL );
120+ assertEquals (taskManager.getFirstTask (), NULL );
121121
122122 auto taskId1 = taskManager.scheduleFixedRate (10 , recordingJob, TIME_MILLIS);
123123 auto taskId2 = taskManager.scheduleFixedRate (100 , recordingJob2, TIME_MICROS);
124124
125125 // now check the task registration in detail.
126- assertNotEqual (taskId1, TASKMGR_INVALIDID);
126+ assertNotEquals (taskId1, TASKMGR_INVALIDID);
127127 TimerTask* task = taskManager.getFirstTask ();
128- assertNotEqual (task, NULL );
128+ assertNotEquals (task, NULL );
129129 assertFalse (task->isMillisSchedule ());
130130 assertTrue (task->isMicrosSchedule ());
131131
132132 // now check the task registration in detail.
133- assertNotEqual (taskId2, TASKMGR_INVALIDID);
133+ assertNotEquals (taskId2, TASKMGR_INVALIDID);
134134 task = task->getNext ();
135- assertNotEqual (task, NULL );
135+ assertNotEquals (task, NULL );
136136 assertTrue (task->isMillisSchedule ());
137137 assertFalse (task->isMicrosSchedule ());
138138
@@ -145,26 +145,26 @@ testF(TimingHelpFixture, scheduleFixedRateTestCase) {
145145 dumpTasks ();
146146
147147 // make sure the yield timings were in range.
148- assertLess (timeTaken, (uint32_t ) 25 );
149- assertMoreOrEqual (timeTaken, (uint32_t ) 20 );
148+ assertLessThan ( (uint32_t ) 25 , timeTaken );
149+ assertMoreThan ( (uint32_t ) 19 , timeTaken );
150150
151151 // now make sure that we got in the right ball park of calls.
152- assertMore (count, 1 );
153- assertMore (count2, 150 );
152+ assertMoreThan ( 1 , count );
153+ assertMoreThan ( 150 , count2 );
154154}
155155
156156testF (TimingHelpFixture, cancellingAJobAfterCreation) {
157- assertEqual (taskManager.getFirstTask (), NULL );
157+ assertEquals (taskManager.getFirstTask (), nullptr );
158158
159159 auto taskId = taskManager.scheduleFixedRate (10 , recordingJob, TIME_MILLIS);
160160
161161 // now check the task registration in detail.
162- assertNotEqual (taskId, TASKMGR_INVALIDID);
162+ assertNotEquals (taskId, TASKMGR_INVALIDID);
163163 TimerTask* task = taskManager.getFirstTask ();
164- assertNotEqual (task, NULL );
164+ assertNotEquals (task, NULL );
165165 assertTrue (task->isMillisSchedule ());
166166 assertFalse (task->isMicrosSchedule ());
167- assertMore ( task->microsFromNow (), 8000UL );
167+ assertMoreThan ( 8000UL , task->microsFromNow ());
168168
169169 assertThatTaskRunsOnTime (10000 , MILLIS_ALLOWANCE);
170170
@@ -174,5 +174,5 @@ testF(TimingHelpFixture, cancellingAJobAfterCreation) {
174174 taskManager.yieldForMicros (100 ); // needs to run the cancellation task.
175175 assertTasksSpacesTaken (0 );
176176
177- assertEqual (taskManager.getFirstTask (), NULL );
177+ assertEquals (taskManager.getFirstTask (), NULL );
178178}
0 commit comments