---
url: /dyad/dev/stdlib/BlockComponents/tests/Logical.Tests.LogicalValidation.md
description: >-
  Dyad Logical.Tests.LogicalValidation docs.  Validation test for all Logical
  blocks with deterministic expected outputs.
---

# `Logical.Tests.LogicalValidation` {#Logical.Tests.LogicalValidation}

Validation test for all Logical blocks with deterministic expected outputs.

Uses a Ramp with height=4, duration=4: ramp(t) = offset + t. At t=1 (the common stop time), ramp = offset + 1. A Constant at 1.0 serves as the second input for two-input comparisons. All threshold blocks use threshold = 1.0.

Three test cases via `params` overriding `ramp.offset`:

* below (offset=-2): ramp(1)=-1.0 < threshold

* equal (offset=0):  ramp(1)=1.0 = threshold

* above (offset=1.5): ramp(1)=2.5 > threshold

## Usage {#Usage}

`BlockComponents.Logical.Tests.LogicalValidation()`

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Validation test for all Logical blocks with deterministic expected outputs.

Uses a Ramp with height=4, duration=4: ramp(t) = offset + t.
At t=1 (the common stop time), ramp = offset + 1.
A Constant at 1.0 serves as the second input for two-input comparisons.
All threshold blocks use threshold = 1.0.

Three test cases via `params` overriding `ramp.offset`:
- below (offset=-2): ramp(1)=-1.0 < threshold
- equal (offset=0):  ramp(1)=1.0 = threshold
- above (offset=1.5): ramp(1)=2.5 > threshold
"""
test component LogicalValidation
  "Ramp: ramp(t) = offset + t for t in [0, 4]"
  ramp = BlockComponents.Sources.Ramp(height = 4, duration = 4, offset = -2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 1200, "x2": 120, "y2": 1300, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant reference at 1.0"
  const1 = BlockComponents.Sources.Constant(k = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 405, "x2": 120, "y2": 505, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant reference at 10.0 for Switch test"
  const10 = BlockComponents.Sources.Constant(k = 10.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 1301, "x2": 271, "y2": 1401, "rot": 0}
      },
      "tags": []
    }
  }
  "Always-true boolean source (threshold well below ramp range)"
  boolTrue = BlockComponents.Logical.GreaterThreshold(threshold = -100.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 620, "x2": 271, "y2": 720, "rot": 0}
      },
      "tags": []
    }
  }
  "Always-false boolean source (threshold well above ramp range)"
  boolFalse = BlockComponents.Logical.GreaterThreshold(threshold = 100.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 740, "x2": 271, "y2": 840, "rot": 0}
      },
      "tags": []
    }
  }
  "Threshold comparisons (threshold = 1.0)"
  gt_thresh = BlockComponents.Logical.GreaterThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 980, "x2": 271, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  ge_thresh = BlockComponents.Logical.GreaterEqualThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 1100, "x2": 271, "y2": 1200, "rot": 0}
      },
      "tags": []
    }
  }
  lt_thresh = BlockComponents.Logical.LessThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 860, "x2": 271, "y2": 960, "rot": 0}
      },
      "tags": []
    }
  }
  le_thresh = BlockComponents.Logical.LessEqualThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 500, "x2": 271, "y2": 600, "rot": 0}
      },
      "tags": []
    }
  }
  "Two-input comparisons: ramp (u1) vs const1 (u2)"
  gt = BlockComponents.Logical.Greater() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 140, "x2": 271, "y2": 240, "rot": 0}
      },
      "tags": []
    }
  }
  ge = BlockComponents.Logical.GreaterEqual() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 380, "x2": 271, "y2": 480, "rot": 0}
      },
      "tags": []
    }
  }
  lt = BlockComponents.Logical.Less() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 260, "x2": 271, "y2": 360, "rot": 0}
      },
      "tags": []
    }
  }
  le = BlockComponents.Logical.LessEqual() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 180, "y1": 20, "x2": 280, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Not: inverts GreaterThreshold output"
  not1 = BlockComponents.Logical.Not() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 980, "x2": 412, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  "Switch: selects ramp (u1) when gt_thresh true, else const10 (u3)"
  sw = BlockComponents.Logical.Switch() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 1232, "x2": 412, "y2": 1332, "rot": 0}
      },
      "tags": []
    }
  }
  "LogicalSwitch: selects boolTrue (u1) when gt_thresh true, else boolFalse (u3)"
  lsw = BlockComponents.Logical.LogicalSwitch() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 703, "x2": 412, "y2": 803, "rot": 0}
      },
      "tags": []
    }
  }
relations
  # Threshold comparisons: all driven by ramp
  connect(ramp.y, gt_thresh.u) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 140, "y": 1250}, {"x": 140, "y": 1030}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, ge_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 1150}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, lt_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 910}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, le_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 550}],
      "renderStyle": "standard"
    }
  }
  # Two-input comparisons: ramp (u1) vs const1 (u2)
  connect(ramp.y, gt.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 159}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, gt.u2) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 150, "y": 455}, {"x": 150, "y": 215}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, ge.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 399}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, ge.u2) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(ramp.y, lt.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 279}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, lt.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 150, "y": 455}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 150, "y": 335}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, le.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}, {"x": 140, "y": 39}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, le.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 150, "y": 455}, {"x": 150, "y": 95}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Not: inverts GreaterThreshold
  connect(gt_thresh.y, not1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Boolean sources for LogicalSwitch
  connect(ramp.y, boolTrue.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 670}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, boolFalse.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 790}],
      "renderStyle": "standard"
    }
  }
  # Switch: u2=gt_thresh controls between ramp (u1) and const10 (u3)
  connect(ramp.y, sw.u1) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(gt_thresh.y, sw.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 291, "y": 1282}], "E": 2}],
      "junctions": [{"x": 291, "y": 1030}],
      "renderStyle": "standard"
    }
  }
  connect(const10.y, sw.u3) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 1351}, {"x": 291, "y": 1314}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # LogicalSwitch: u2=gt_thresh controls between boolTrue (u1) and boolFalse (u3)
  connect(boolTrue.y, lsw.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 670}, {"x": 291, "y": 716}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(gt_thresh.y, lsw.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 1030}, {"x": 291, "y": 753}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(boolFalse.y, lsw.u3) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "below": {
        "stop": 1,
        "params": {"ramp.offset": -2},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      },
      "equal": {
        "stop": 1,
        "params": {"ramp.offset": 0},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      },
      "above": {
        "stop": 1,
        "params": {"ramp.offset": 1.5},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      }
    }
  }
}
end
```

```dyad
"""
Validation test for all Logical blocks with deterministic expected outputs.

Uses a Ramp with height=4, duration=4: ramp(t) = offset + t.
At t=1 (the common stop time), ramp = offset + 1.
A Constant at 1.0 serves as the second input for two-input comparisons.
All threshold blocks use threshold = 1.0.

Three test cases via `params` overriding `ramp.offset`:
- below (offset=-2): ramp(1)=-1.0 < threshold
- equal (offset=0):  ramp(1)=1.0 = threshold
- above (offset=1.5): ramp(1)=2.5 > threshold
"""
test component LogicalValidation
  "Ramp: ramp(t) = offset + t for t in [0, 4]"
  ramp = BlockComponents.Sources.Ramp(height = 4, duration = 4, offset = -2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 1200, "x2": 120, "y2": 1300, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant reference at 1.0"
  const1 = BlockComponents.Sources.Constant(k = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 405, "x2": 120, "y2": 505, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant reference at 10.0 for Switch test"
  const10 = BlockComponents.Sources.Constant(k = 10.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 1301, "x2": 271, "y2": 1401, "rot": 0}
      },
      "tags": []
    }
  }
  "Always-true boolean source (threshold well below ramp range)"
  boolTrue = BlockComponents.Logical.GreaterThreshold(threshold = -100.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 620, "x2": 271, "y2": 720, "rot": 0}
      },
      "tags": []
    }
  }
  "Always-false boolean source (threshold well above ramp range)"
  boolFalse = BlockComponents.Logical.GreaterThreshold(threshold = 100.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 740, "x2": 271, "y2": 840, "rot": 0}
      },
      "tags": []
    }
  }
  "Threshold comparisons (threshold = 1.0)"
  gt_thresh = BlockComponents.Logical.GreaterThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 980, "x2": 271, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  ge_thresh = BlockComponents.Logical.GreaterEqualThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 1100, "x2": 271, "y2": 1200, "rot": 0}
      },
      "tags": []
    }
  }
  lt_thresh = BlockComponents.Logical.LessThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 860, "x2": 271, "y2": 960, "rot": 0}
      },
      "tags": []
    }
  }
  le_thresh = BlockComponents.Logical.LessEqualThreshold(threshold = 1.0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 500, "x2": 271, "y2": 600, "rot": 0}
      },
      "tags": []
    }
  }
  "Two-input comparisons: ramp (u1) vs const1 (u2)"
  gt = BlockComponents.Logical.Greater() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 140, "x2": 271, "y2": 240, "rot": 0}
      },
      "tags": []
    }
  }
  ge = BlockComponents.Logical.GreaterEqual() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 380, "x2": 271, "y2": 480, "rot": 0}
      },
      "tags": []
    }
  }
  lt = BlockComponents.Logical.Less() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 171, "y1": 260, "x2": 271, "y2": 360, "rot": 0}
      },
      "tags": []
    }
  }
  le = BlockComponents.Logical.LessEqual() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 180, "y1": 20, "x2": 280, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Not: inverts GreaterThreshold output"
  not1 = BlockComponents.Logical.Not() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 980, "x2": 412, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  "Switch: selects ramp (u1) when gt_thresh true, else const10 (u3)"
  sw = BlockComponents.Logical.Switch() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 1232, "x2": 412, "y2": 1332, "rot": 0}
      },
      "tags": []
    }
  }
  "LogicalSwitch: selects boolTrue (u1) when gt_thresh true, else boolFalse (u3)"
  lsw = BlockComponents.Logical.LogicalSwitch() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 312, "y1": 703, "x2": 412, "y2": 803, "rot": 0}
      },
      "tags": []
    }
  }
relations
  # Threshold comparisons: all driven by ramp
  connect(ramp.y, gt_thresh.u) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 140, "y": 1250}, {"x": 140, "y": 1030}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, ge_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 1150}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, lt_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 910}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, le_thresh.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 550}],
      "renderStyle": "standard"
    }
  }
  # Two-input comparisons: ramp (u1) vs const1 (u2)
  connect(ramp.y, gt.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 159}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, gt.u2) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 150, "y": 455}, {"x": 150, "y": 215}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, ge.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 399}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, ge.u2) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(ramp.y, lt.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 279}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, lt.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 150, "y": 455}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 150, "y": 335}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, le.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}, {"x": 140, "y": 39}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(const1.y, le.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 150, "y": 455}, {"x": 150, "y": 95}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Not: inverts GreaterThreshold
  connect(gt_thresh.y, not1.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Boolean sources for LogicalSwitch
  connect(ramp.y, boolTrue.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 670}],
      "renderStyle": "standard"
    }
  }
  connect(ramp.y, boolFalse.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 140, "y": 1250}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 140, "y": 790}],
      "renderStyle": "standard"
    }
  }
  # Switch: u2=gt_thresh controls between ramp (u1) and const10 (u3)
  connect(ramp.y, sw.u1) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(gt_thresh.y, sw.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 291, "y": 1282}], "E": 2}],
      "junctions": [{"x": 291, "y": 1030}],
      "renderStyle": "standard"
    }
  }
  connect(const10.y, sw.u3) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 1351}, {"x": 291, "y": 1314}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # LogicalSwitch: u2=gt_thresh controls between boolTrue (u1) and boolFalse (u3)
  connect(boolTrue.y, lsw.u1) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 670}, {"x": 291, "y": 716}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(gt_thresh.y, lsw.u2) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 291, "y": 1030}, {"x": 291, "y": 753}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(boolFalse.y, lsw.u3) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://BlockComponents/Example.svg"},
    "tests": {
      "below": {
        "stop": 1,
        "params": {"ramp.offset": -2},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      },
      "equal": {
        "stop": 1,
        "params": {"ramp.offset": 0},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      },
      "above": {
        "stop": 1,
        "params": {"ramp.offset": 1.5},
        "expect": {
          "signals": [
            "ramp.y",
            "gt_thresh.y",
            "ge_thresh.y",
            "lt_thresh.y",
            "le_thresh.y",
            "gt.y",
            "ge.y",
            "lt.y",
            "le.y",
            "not1.y",
            "sw.y",
            "lsw.y"
          ]
        }
      }
    }
  }
}
end
```

## Test Cases {#Test-Cases}

### Test Case `below` {#Test-Case-below}

```julia
plt
```

![](pyxecbu.svg)

```julia
plt
```

![](xfpostx.svg)

```julia
plt
```

![](elbfqwv.svg)

```julia
plt
```

![](tvvnzcu.svg)

```julia
plt
```

![](crtuzum.svg)

```julia
plt
```

![](ytwenlk.svg)

```julia
plt
```

![](ynnaxee.svg)

```julia
plt
```

![](irkbnlo.svg)

```julia
plt
```

![](jdfkfqk.svg)

```julia
plt
```

![](nhapcek.svg)

```julia
plt
```

![](fjikwrb.svg)

```julia
plt
```

![](cbymrtz.svg)

### Test Case `equal` {#Test-Case-equal}

```julia
plt
```

![](bphiaun.svg)

```julia
plt
```

![](whdwwnq.svg)

```julia
plt
```

![](gxdgwxk.svg)

```julia
plt
```

![](dogifvk.svg)

```julia
plt
```

![](unyosud.svg)

```julia
plt
```

![](jqcauaf.svg)

```julia
plt
```

![](rzmuqfy.svg)

```julia
plt
```

![](htkzexy.svg)

```julia
plt
```

![](xtkeuor.svg)

```julia
plt
```

![](hqzejcf.svg)

```julia
plt
```

![](ghowopz.svg)

```julia
plt
```

![](krxnefv.svg)

### Test Case `above` {#Test-Case-above}

```julia
plt
```

![](viphpmd.svg)

```julia
plt
```

![](okhozpe.svg)

```julia
plt
```

![](fjevaoe.svg)

```julia
plt
```

![](amchcrq.svg)

```julia
plt
```

![](ibmunap.svg)

```julia
plt
```

![](zetbbqm.svg)

```julia
plt
```

![](huzvgpa.svg)

```julia
plt
```

![](njjrszk.svg)

```julia
plt
```

![](zsnxqwt.svg)

```julia
plt
```

![](jdcxoqb.svg)

```julia
plt
```

![](xbiipko.svg)

```julia
plt
```

![](lrzadsm.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Constant`](Logical.Tests.LogicalValidation.md)

  * [`Greater`](Logical.Tests.LogicalValidation.md)

  * [`GreaterEqual`](Logical.Tests.LogicalValidation.md)

  * [`GreaterEqualThreshold`](Logical.Tests.LogicalValidation.md)

  * [`GreaterThreshold`](Logical.Tests.LogicalValidation.md)

  * [`Less`](Logical.Tests.LogicalValidation.md)

  * [`LessEqual`](Logical.Tests.LogicalValidation.md)

  * [`LessEqualThreshold`](Logical.Tests.LogicalValidation.md)

  * [`LessThreshold`](Logical.Tests.LogicalValidation.md)

  * [`LogicalSwitch`](Logical.Tests.LogicalValidation.md)

  * [`Not`](Logical.Tests.LogicalValidation.md)

  * [`Ramp`](Logical.Tests.LogicalValidation.md)

  * [`Switch`](Logical.Tests.LogicalValidation.md)
