15
15
*/
16
16
17
17
#if !DEVICE_LOWPOWERTIMER
18
- #error [NOT_SUPPORTED] Low power timer not supported for this target
18
+ #error [NOT_SUPPORTED] Low power timer not supported for this target
19
19
#endif
20
20
21
21
#include " utest/utest.h"
22
22
#include " unity/unity.h"
23
23
#include " greentea-client/test_env.h"
24
24
25
25
#include " mbed.h"
26
+ #include " ../timeout/timeout_tests.h"
26
27
27
28
using namespace utest ::v1;
28
29
@@ -33,7 +34,8 @@ static LowPowerTimeout lpt;
33
34
#define LONG_TIMEOUT (100000 )
34
35
#define SHORT_TIMEOUT (600 )
35
36
36
- void cb_done () {
37
+ void cb_done ()
38
+ {
37
39
complete = true ;
38
40
}
39
41
@@ -119,29 +121,48 @@ void lp_timeout_500us(void)
119
121
120
122
}
121
123
122
- utest::v1::status_t greentea_failure_handler (const Case *const source, const failure_t reason) {
124
+ utest::v1::status_t greentea_failure_handler (const Case * const source, const failure_t reason)
125
+ {
123
126
greentea_case_failure_abort_handler (source, reason);
124
127
return STATUS_CONTINUE;
125
128
}
126
129
127
130
Case cases[] = {
131
+ Case (" Callback called once (with attach)" , test_single_call<AttachTester<LowPowerTimeout> >),
132
+ Case (" Callback called once (with attach_us)" , test_single_call<AttachUSTester<LowPowerTimeout> >),
133
+
134
+ Case (" Callback not called when cancelled (with attach)" , test_cancel<AttachUSTester<LowPowerTimeout> >),
135
+ Case (" Callback not called when cancelled (with attach_us)" , test_cancel<AttachUSTester<LowPowerTimeout> >),
136
+
137
+ Case (" Callback override (with attach)" , test_override<AttachTester<LowPowerTimeout> >),
138
+ Case (" Callback override (with attach_us)" , test_override<AttachUSTester<LowPowerTimeout> >),
139
+
140
+ Case (" Multiple timeouts running in parallel (with attach)" , test_multiple<AttachTester<LowPowerTimeout> >),
141
+ Case (" Multiple timeouts running in parallel (with attach_us)" , test_multiple<AttachUSTester<LowPowerTimeout> >),
142
+
143
+ Case (" Zero delay (with attach)" , test_no_wait<AttachTester<LowPowerTimeout> >),
144
+ Case (" Zero delay (with attach_us)" , test_no_wait<AttachUSTester<LowPowerTimeout> >),
145
+
128
146
Case (" 500us LowPowerTimeout" , lp_timeout_500us, greentea_failure_handler),
129
147
Case (" 1ms LowPowerTimeout" , lp_timeout_1ms, greentea_failure_handler),
130
148
Case (" 1sec LowPowerTimeout" , lp_timeout_1s, greentea_failure_handler),
131
149
Case (" 5sec LowPowerTimeout" , lp_timeout_5s, greentea_failure_handler),
150
+
132
151
#if DEVICE_SLEEP
133
152
Case (" 1sec LowPowerTimeout from sleep" , lp_timeout_1s_sleep, greentea_failure_handler),
134
153
Case (" 1sec LowPowerTimeout from deepsleep" , lp_timeout_1s_deepsleep, greentea_failure_handler),
135
154
#endif /* DEVICE_SLEEP */
136
155
};
137
156
138
- utest::v1::status_t greentea_test_setup (const size_t number_of_cases) {
157
+ utest::v1::status_t greentea_test_setup (const size_t number_of_cases)
158
+ {
139
159
GREENTEA_SETUP (20 , " default_auto" );
140
160
return greentea_test_setup_handler (number_of_cases);
141
161
}
142
162
143
163
Specification specification (greentea_test_setup, cases, greentea_test_teardown_handler);
144
164
145
- int main () {
165
+ int main ()
166
+ {
146
167
Harness::run (specification);
147
168
}
0 commit comments