MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / newTestThreshold

Function newTestThreshold

go/engine/node/trigger/threshold_test.go:23–37  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

21// newTestThreshold constructs an OnThreshold against a fresh scope and
22// returns the trigger plus the scope used to push values.
23func 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.
40func fired(t *testing.T, tr *OnThreshold, v expr.Value) bool {

Callers 3

TestOnThreshold_AnalyzeFunction · 0.85
TestOnThreshold_OutputsFunction · 0.85
TestOnThreshold_WaitFunction · 0.85

Calls 1

NewOnThresholdFunction · 0.85

Tested by

no test coverage detected