newTestThreshold constructs an OnThreshold against a fresh scope and returns the trigger plus the scope used to push values.
(t *testing.T, threshold float64, dir Direction, deadband float64, binding *workflow.OutputBinding)
| 21 | // newTestThreshold constructs an OnThreshold against a fresh scope and |
| 22 | // returns the trigger plus the scope used to push values. |
| 23 | func newTestThreshold(t *testing.T, threshold float64, dir Direction, deadband float64, binding *workflowapi.OutputBinding) (*OnThreshold, *engine.Scope) { |
| 24 | t.Helper() |
| 25 | scope, err := engine.NewMainScope(nil) |
| 26 | require.NoError(t, err) |
| 27 | tr := NewOnThreshold( |
| 28 | "th", |
| 29 | workflowapi.Reference{SrcId: "src", VarId: "v"}, |
| 30 | threshold, |
| 31 | dir, |
| 32 | deadband, |
| 33 | binding, |
| 34 | scope, |
| 35 | ) |
| 36 | return tr, scope |
| 37 | } |
| 38 | |
| 39 | // fired runs analyze, asserts it returned no error, and yields whether it fired. |
| 40 | func fired(t *testing.T, tr *OnThreshold, v expr.Value) bool { |
no test coverage detected