joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Harness Class Reference

Harness Class Reference

Test Harness. More...

#include <utest_harness.h>

Static Public Member Functions

static bool run (const Specification &specification)
 Runs a test specification.
static bool is_busy ()
static bool set_scheduler (utest_v1_scheduler_t scheduler)
 Sets the scheduler to be used.
static void validate_callback (const control_t control=control_t())
 Call this function in the asynchronous callback that you have been waiting for.
static void raise_failure (const failure_reason_t reason)
 Raising a failure causes the failure to be counted and the failure handler to be called.

Detailed Description

Test Harness.

This class runs a test specification for you and calls all required handlers. The harness executes the test specification in an asynchronous fashion, therefore `run()` returns immediately.

By default, this harness uses the MINAR scheduler for asynchronous callbacks. If you wamt to provide your own custom scheduler, set `config.utest.use_custom_scheduler` to `true` inside your yotta config and set a custom scheduler implementation using the `set_scheduler()` function. You must set the scheduler before running a specification.

Note:
In case of an test abort, the harness will busy-wait and never finish.

Definition at line 49 of file utest_harness.h.


Member Function Documentation

bool is_busy (  ) [static]
Returns:
`true` if a test specification is being executed, `false` otherwise

Definition at line 287 of file utest_harness.cpp.

void raise_failure ( const failure_reason_t  reason ) [static]

Raising a failure causes the failure to be counted and the failure handler to be called.

Further action then depends on its return state.

Definition at line 167 of file utest_harness.cpp.

bool run ( const Specification specification ) [static]

Runs a test specification.

Return values:
`true`if the specification can be run
`false`if another specification is currently running

Definition at line 98 of file utest_harness.cpp.

bool set_scheduler ( utest_v1_scheduler_t  scheduler ) [static]

Sets the scheduler to be used.

Returns:
`true` if scheduler is properly specified (all functions non-null).

Definition at line 74 of file utest_harness.cpp.

void validate_callback ( const control_t  control = control_t() ) [static]

Call this function in the asynchronous callback that you have been waiting for.

You can only validate a callback once, calling this function when no callback is expected has no side effects. After callback validation, the next test case is scheduled.

You may specify additional test case attributes with this callback. So for example, you may delay the decision to repeat an asynchronous test case until the callback needs to be validated.

However, be aware, that only the repeat attributes can be modified and the usual arbitration rules apply. The modified case attributes are only valid until the case handler returns updated attributes.

Parameters:
controlthe test case attribute to be added to the existing attributes.

Definition at line 269 of file utest_harness.cpp.