MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestVariadicLogicalOperators

Function TestVariadicLogicalOperators

cel/cel_test.go:1693–1712  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1691}
1692
1693func TestVariadicLogicalOperators(t *testing.T) {
1694 env := testEnv(t, variadicLogicalOperatorASTs())
1695 ast, iss := env.Compile(
1696 `(false || false || false || false || true) &&
1697 (true && true && true && true && false)`)
1698 if iss.Err() != nil {
1699 t.Fatalf("Compile() failed: %v", iss.Err())
1700 }
1701 prg, err := env.Program(ast)
1702 if err != nil {
1703 t.Fatalf("Program(ast) failed: %v", err)
1704 }
1705 out, _, err := prg.Eval(NoVars())
1706 if err != nil {
1707 t.Errorf("Eval() got error %v, wanted false", err)
1708 }
1709 if out != types.False {
1710 t.Errorf("Eval() got %v, wanted false", out)
1711 }
1712}
1713
1714func TestCostTrackingWithStateTracking(t *testing.T) {
1715 // Cost tracking and state tracking install separate observers. Every observer has to see

Callers

nothing calls this directly

Calls 7

NoVarsFunction · 0.85
ErrMethod · 0.80
ProgramMethod · 0.80
testEnvFunction · 0.70
CompileMethod · 0.65
EvalMethod · 0.65

Tested by

no test coverage detected