mirror of https://github.com/ARMmbed/mbed-os.git
Types: Add `CaseNoRepeat` and `CaseNoTimeout` aliases. Add combination unit tests for aliases and fix bugs.
This allows inline use of these properties. Example: `CaseTimeout(ms) + (repeat_count < 100 ? CaseRepeatAll : CaseNoRepeat);`
parent
ea2befaeee
commit
aca2e920e3
|
@ -119,15 +119,20 @@ namespace v1 {
|
||||||
repeat_t(this->repeat | rhs.repeat),
|
repeat_t(this->repeat | rhs.repeat),
|
||||||
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : this->timeout);
|
(rhs.timeout == TIMEOUT_NONE) ? rhs.timeout : this->timeout);
|
||||||
|
|
||||||
|
if (result.timeout != TIMEOUT_NONE && result.timeout > rhs.timeout) {
|
||||||
|
result.timeout = rhs.timeout;
|
||||||
|
}
|
||||||
|
|
||||||
if (result.repeat & REPEAT_NONE) {
|
if (result.repeat & REPEAT_NONE) {
|
||||||
result.repeat = REPEAT_NONE;
|
result.repeat = REPEAT_NONE;
|
||||||
}
|
}
|
||||||
else if (result.repeat & REPEAT_SETUP_TEARDOWN) {
|
else {
|
||||||
result.repeat = repeat_t(result.repeat & ~REPEAT_CASE_ONLY);
|
if (result.repeat & REPEAT_SETUP_TEARDOWN) {
|
||||||
}
|
result.repeat = repeat_t(result.repeat & ~REPEAT_CASE_ONLY);
|
||||||
|
}
|
||||||
if (result.timeout != TIMEOUT_NONE && result.timeout > rhs.timeout) {
|
if (result.timeout == TIMEOUT_NONE && result.repeat & REPEAT_ON_TIMEOUT) {
|
||||||
result.timeout = rhs.timeout;
|
result.repeat = repeat_t(result.repeat & ~REPEAT_ON_TIMEOUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -148,14 +153,18 @@ namespace v1 {
|
||||||
friend class Harness;
|
friend class Harness;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// does not repeat this test case, but moves on to the next one
|
/// does not repeat this test case and immediately moves on to the next one without timeout
|
||||||
const control_t CaseNext(REPEAT_NONE, TIMEOUT_NONE);
|
const control_t CaseNext(REPEAT_NONE, TIMEOUT_NONE);
|
||||||
|
|
||||||
|
/// does not repeat this test case, moves on to the next one
|
||||||
|
const control_t CaseNoRepeat(REPEAT_NONE);
|
||||||
/// repeats the test case handler with calling teardown and setup handlers
|
/// repeats the test case handler with calling teardown and setup handlers
|
||||||
const control_t CaseRepeatAll(REPEAT_ALL);
|
const control_t CaseRepeatAll(REPEAT_ALL);
|
||||||
/// repeats only the test case handler without calling teardown and setup handlers
|
/// repeats only the test case handler without calling teardown and setup handlers
|
||||||
const control_t CaseRepeatHandler(REPEAT_HANDLER);
|
const control_t CaseRepeatHandler(REPEAT_HANDLER);
|
||||||
|
|
||||||
|
/// No timeout, immediately moves on to the next case, but allows repeats
|
||||||
|
const control_t CaseNoTimeout(TIMEOUT_NONE);
|
||||||
/// Awaits until the callback is validated and never times out. Use with caution!
|
/// Awaits until the callback is validated and never times out. Use with caution!
|
||||||
const control_t CaseAwait(TIMEOUT_FOREVER);
|
const control_t CaseAwait(TIMEOUT_FOREVER);
|
||||||
/// Alias class for asynchronous timeout control in milliseconds
|
/// Alias class for asynchronous timeout control in milliseconds
|
||||||
|
|
Loading…
Reference in New Issue