Test harness#
A test harness is a particular operator that can be declared only in a test module (*.swant) and with the following specificities:
It has no declared I/Os.
It has one implicit input _current_cycle: uint64; intended to contain the current cycle counter.
It has one implicit output _stop_condition: bool default=false; when it’s True, intended to indicate that the execution can be suspended or stopped.
It cannot be instantiated.
It must provide definitions for all sensors used in its cone of influence.
To include a test harness in a Test module, use the TestModuleCreator.add_test_harness() method.
TestHarness class#
Fig. 20 Diagram class diagram for Test harness#
- class ansys.scadeone.core.swan.TestHarness(id: Identifier, body: Scope | Equation | Callable | None, pragmas: List[Pragma] | None = None)#
Bases:
Declaration,ModuleItem,TestHarnessDiagramCreatorTest harness definition.
- static set_owner(owner: SwanItem | IModel | None, children: SwanItem | Iterable[SwanItem] | None) None#
Helper to set owner as the owner of each item in the Iterable items.
- property id: Identifier#
Language item identifier.
- property is_protected: bool#
Tell if a construct item is syntactically protected with some markup and is stored as a string (without the markup).
- property model: IModel#
Return model containing the Swan item.
- property module: ModuleBase | None#
Module containing the item.
- Returns:
ModuleBase: module container, see
ModuleBodyandModuleInterfaceor None if the object is itself a module.