[][src]Struct lrl_test_compiler::test_builder::TestBuilder

pub struct TestBuilder {
    pub test: Test,
    pub env: Environment,
}

Builder for a TDF test struct and the associated environment

Fields

test: Testenv: Environment

Implementations

impl TestBuilder[src]

pub fn new() -> Self[src]

Create an empty TestBuilder with default test and environment

fn default_test() -> Test[src]

Build a completely empty Test struct

fn default_env() -> Environment[src]

Build a completely empty Environment struct apart from a couple necessary config values

pub fn with_abort(&mut self, abort_name: &str) -> InstructionStreamBuilder<'_>[src]

Add an abort to the test struct and return an InstructionStreamBuilder that will build instructions for this abort

pub fn with_body(&mut self) -> InstructionStreamBuilder<'_>[src]

Get an InstructionStreamBuilder that will build instructions for the test body

pub fn with_sensor(&mut self, sensor_name: &str) -> &mut Self[src]

Add a sensor record into the environment if one with the given name does not already exist Automatically uses a 1ms polling interval and the numeric calibration file in the tests/input_files directory

pub fn with_relay(&mut self, relay_name: &str) -> &mut Self[src]

Add a relay record into the environment if one with the given name does not already exist.

pub fn with_v_sensor(&mut self, sensor_name: &str) -> &mut Self[src]

Add a virtual sensor record into the environment if one with the given name does not already exist. Automatically uses the driver "test_sensor_driver" with no arguments, a 1ms polling interval, and the numeric calibration file in the tests/input_files directory

pub fn with_v_relay(&mut self, relay_name: &str) -> &mut Self[src]

Add a virtual relay record into the environment if one with the given name does not already exist. Automatically uses the driver "test_relay_driver" with no arguments.

pub fn with_safe_state_relay(&mut self, relay_name: &str) -> &mut Self[src]

Add a relay name into the configured safe state No error checks are performed

fn get_section_with_name(
    &self,
    section_name: &str,
    stream_id: &StreamId<'_>
) -> &Vec<Statement>
[src]

Get a reference to the statements within the section statement defined with the given name. Searches for the section name within the given StreamId This is used to add statements using the StreamId::Section Variant

fn get_section_with_name_mut(
    &mut self,
    section_name: &str,
    stream_id: &StreamId<'_>
) -> &mut Vec<Statement>
[src]

Get a mutable reference to the statements within the section statement defined with the given name. Searches for the section name within the given StreamId This is used to add statements using the StreamId::Section Variant

pub fn get_statements(&self, stream_id: &StreamId<'_>) -> &Vec<Statement>[src]

Get the vector of statements in the given stream id

pub fn get_statements_mut(
    &mut self,
    stream_id: &StreamId<'_>
) -> &mut Vec<Statement>
[src]

Get a mutable reference to the vector of statements in the given stream id

Trait Implementations

impl Debug for TestBuilder[src]

Auto Trait Implementations

impl RefUnwindSafe for TestBuilder

impl Send for TestBuilder

impl Sync for TestBuilder

impl Unpin for TestBuilder

impl UnwindSafe for TestBuilder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]