Rtos API example

Embed: (wiki syntax)

« Back to documentation index

control_t Struct Reference

control_t Struct Reference
[Frameworks]

Control class for specifying test case attributes. More...

#include <utest_types.h>

Inherits utest::v1::base_control_t.


Detailed Description

Control class for specifying test case attributes.

This class encapsulated control information about test cases which, when returned from a test case influences the behavior of the test harness. Instead of using this class directly it is recommended to use the aliases for clearer semantics:

 control_t test_case(const size_t call_count) {
     // repeat 5 times for a total of 6 calls
     return (call_count < 6) ? CaseRepeatHandler : CaseNext;
 }

This class overloads the `+` operator to implement something similiar to saturated arbitration:

  • The lower timeout value "wins".
  • A more involved repeat "wins" (ie. `ALL` > 'HANDLER' > 'NONE').
  • Next Case always wins.

You may then add timeouts and repeats together:

 control_t test_case(const size_t call_count) {
     // repeat 5 times for a total of 6 calls, each with a 500ms asynchronous timeout
     return CaseTimeout(500) + ((call_count < 6) ? CaseRepeatAll : CaseNoRepeat);
 }

In the future, more control information may be added transparently and backwards compatible.

Definition at line 174 of file utest_types.h.