Skip to content
StepTest.md

StepTest

Test that validates step response behavior by connecting a step signal to a terminator.

This component creates a test setup for validating the Step block by connecting its output to a Terminator. The Step block generates a signal that starts at the offset value and jumps by the height value at the start_time. The test case verifies that the signal properly transitions from the initial offset value to the final value (offset + height).

Usage

StepTest()

Behavior

signal.y(t)=terminator.u(t)signal.y(t)=ifelse(tsignal.start_time,signal.height+signal.offset,signal.offset)

Source

dyad
# Test that validates step response behavior by connecting a step signal to a terminator.
#
# This component creates a test setup for validating the `Step` block by connecting its output
# to a `Terminator`. The `Step` block generates a signal that starts at the `offset` value and jumps
# by the `height` value at the `start_time`. The test case verifies that the signal properly
# transitions from the initial offset value to the final value (offset + height).
test component StepTest
  # Terminates a signal connection without passing it further
  terminator = Terminator()
  # Generates a step signal with configurable height, offset and start time
  signal = Step(height=1.4, offset=0.5, start_time=0.5)
relations
  # Connects the step signal output to the terminator input
  connect(signal.y, terminator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 1,
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "terminator.u"],
          "final": {"signal.y": 1.9, "terminator.u": 1.9}
        }
      }
    }
  }
}
end
Flattened Source
dyad
# Test that validates step response behavior by connecting a step signal to a terminator.
#
# This component creates a test setup for validating the `Step` block by connecting its output
# to a `Terminator`. The `Step` block generates a signal that starts at the `offset` value and jumps
# by the `height` value at the `start_time`. The test case verifies that the signal properly
# transitions from the initial offset value to the final value (offset + height).
test component StepTest
  # Terminates a signal connection without passing it further
  terminator = Terminator()
  # Generates a step signal with configurable height, offset and start time
  signal = Step(height=1.4, offset=0.5, start_time=0.5)
relations
  # Connects the step signal output to the terminator input
  connect(signal.y, terminator.u)
metadata {
  "Dyad": {
    "tests": {
      "case1": {
        "stop": 1,
        "expect": {
          "initial": {"signal.y": 0.5},
          "signals": ["signal.y", "terminator.u"],
          "final": {"signal.y": 1.9, "terminator.u": 1.9}
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt