@@ -23,7 +23,7 @@ using namespace utest::v1;
23
23
24
24
#define TEST_DELAY_MS 50
25
25
#define TEST_DELAY2_MS 30
26
- #define TEST_DELAY_MS_DELTA 1
26
+ #define TEST_DELAY_MS_DELTA 5
27
27
#define TEST_RESTART_DELAY_MS 10
28
28
29
29
#if TEST_RESTART_DELAY_MS >= TEST_DELAY_MS
@@ -71,12 +71,12 @@ void test_oneshot_not_restarted()
71
71
t.start ();
72
72
TEST_ASSERT_EQUAL (osOK, stat);
73
73
74
- int32_t slots = sem.wait (TEST_DELAY_MS + 1 );
74
+ int32_t slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
75
75
t.stop ();
76
76
TEST_ASSERT_EQUAL (1 , slots);
77
77
TEST_ASSERT_INT_WITHIN (TEST_DELAY_MS_DELTA * 1000 , TEST_DELAY_MS * 1000 , t.read_us ());
78
78
79
- slots = sem.wait (TEST_DELAY_MS + 1 );
79
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
80
80
TEST_ASSERT_EQUAL (0 , slots);
81
81
82
82
stat = timer.stop ();
@@ -105,20 +105,20 @@ void test_periodic_repeats()
105
105
t.start ();
106
106
TEST_ASSERT_EQUAL (osOK, stat);
107
107
108
- int32_t slots = sem.wait (TEST_DELAY_MS + 1 );
108
+ int32_t slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
109
109
int t1 = t.read_us ();
110
110
TEST_ASSERT_EQUAL (1 , slots);
111
111
TEST_ASSERT_INT_WITHIN (TEST_DELAY_MS_DELTA * 1000 , TEST_DELAY_MS * 1000 , t1);
112
112
113
- slots = sem.wait (TEST_DELAY_MS + 1 );
113
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
114
114
t.stop ();
115
115
TEST_ASSERT_EQUAL (1 , slots);
116
116
TEST_ASSERT_INT_WITHIN (TEST_DELAY_MS_DELTA * 1000 , TEST_DELAY_MS * 1000 , t.read_us () - t1);
117
117
118
118
stat = timer.stop ();
119
119
TEST_ASSERT_EQUAL (osOK, stat);
120
120
121
- slots = sem.wait (TEST_DELAY_MS + 1 );
121
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
122
122
TEST_ASSERT_EQUAL (0 , slots);
123
123
124
124
stat = timer.stop ();
@@ -153,7 +153,7 @@ void test_restart()
153
153
stat = timer.start (TEST_DELAY_MS);
154
154
TEST_ASSERT_EQUAL (osOK, stat);
155
155
156
- slots = sem.wait (TEST_DELAY_MS + 1 );
156
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
157
157
t.stop ();
158
158
TEST_ASSERT_EQUAL (1 , slots);
159
159
TEST_ASSERT_INT_WITHIN (TEST_DELAY_MS_DELTA * 1000 , (TEST_DELAY_MS + TEST_RESTART_DELAY_MS) * 1000 , t.read_us ());
@@ -183,7 +183,7 @@ void test_start_again()
183
183
stat = timer.start (TEST_DELAY_MS);
184
184
TEST_ASSERT_EQUAL (osOK, stat);
185
185
186
- int32_t slots = sem.wait (TEST_DELAY_MS + 1 );
186
+ int32_t slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
187
187
TEST_ASSERT_EQUAL (1 , slots);
188
188
189
189
stat = timer.stop ();
@@ -192,7 +192,7 @@ void test_start_again()
192
192
stat = timer.start (TEST_DELAY_MS);
193
193
TEST_ASSERT_EQUAL (osOK, stat);
194
194
195
- slots = sem.wait (TEST_DELAY_MS + 1 );
195
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
196
196
TEST_ASSERT_EQUAL (1 , slots);
197
197
198
198
stat = timer.stop ();
@@ -227,7 +227,7 @@ void test_restart_updates_delay()
227
227
t.start ();
228
228
TEST_ASSERT_EQUAL (osOK, stat);
229
229
230
- slots = sem.wait (TEST_DELAY2_MS + 1 );
230
+ slots = sem.wait (TEST_DELAY2_MS + TEST_DELAY_MS_DELTA );
231
231
t.stop ();
232
232
TEST_ASSERT_EQUAL (1 , slots);
233
233
TEST_ASSERT_INT_WITHIN (TEST_DELAY_MS_DELTA * 1000 , TEST_DELAY2_MS * 1000 , t.read_us ());
@@ -273,7 +273,7 @@ void test_stop()
273
273
stat = timer.stop ();
274
274
TEST_ASSERT_EQUAL (osOK, stat);
275
275
276
- slots = sem.wait (TEST_DELAY_MS + 1 );
276
+ slots = sem.wait (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
277
277
TEST_ASSERT_EQUAL (0 , slots);
278
278
279
279
stat = timer.stop ();
@@ -337,7 +337,7 @@ void test_isr_calls_fail()
337
337
Ticker ticker;
338
338
ticker.attach (mbed::callback (timer_isr_call, (void const *) &timer), (float ) TEST_DELAY_MS / 1000.0 );
339
339
340
- wait_ms (TEST_DELAY_MS + 1 );
340
+ wait_ms (TEST_DELAY_MS + TEST_DELAY_MS_DELTA );
341
341
}
342
342
343
343
utest::v1::status_t test_setup (const size_t number_of_cases)
0 commit comments