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

Function testData

interpreter/interpreter_test.go:68–1691  ·  view source on GitHub ↗
(t testing.TB)

Source from the content-addressed store, hash-verified

66}
67
68func testData(t testing.TB) []testCase {
69 return []testCase{
70 {
71 name: "double_ne_nan",
72 expr: `0.0/0.0 == 0.0/0.0`,
73 out: types.False,
74 },
75 {
76 name: "and_false_1st",
77 expr: `false && true`,
78 out: types.False,
79 },
80 {
81 name: "and_false_2nd",
82 expr: `true && false`,
83 out: types.False,
84 },
85 {
86 name: "and_error_1st_false",
87 expr: `1/0 != 0 && false`,
88 out: types.False,
89 },
90 {
91 name: "and_error_2nd_false",
92 expr: `false && 1/0 != 0`,
93 out: types.False,
94 },
95 {
96 name: "and_error_1st_error",
97 expr: `1/0 != 0 && true`,
98 err: "division by zero",
99 },
100 {
101 name: "and_error_2nd_error",
102 expr: `true && 1/0 != 0`,
103 err: "division by zero",
104 },
105 {
106 name: "call_no_args",
107 expr: `zero()`,
108 unchecked: true,
109 funcs: []*decls.FunctionDecl{
110 funcDecl(t, "zero",
111 decls.Overload("zero", []*types.Type{}, types.IntType),
112 decls.SingletonFunctionBinding(func(args ...ref.Val) ref.Val {
113 return types.IntZero
114 }),
115 )},
116 out: types.IntZero,
117 },
118 {
119 name: "call_one_arg",
120 expr: `neg(1)`,
121 unchecked: true,
122 funcs: []*decls.FunctionDecl{
123 funcDecl(t, "neg",
124 decls.Overload("neg_int", []*types.Type{types.IntType}, types.IntType,
125 decls.OverloadOperandTrait(traits.NegatorType),

Callers 3

BenchmarkInterpreterFunction · 0.85
TestInterpreterFunction · 0.85

Calls 15

OverloadFunction · 0.92
SingletonFunctionBindingFunction · 0.92
OverloadOperandTraitFunction · 0.92
UnaryBindingFunction · 0.92
MemberOverloadFunction · 0.92
BinaryBindingFunction · 0.92
DisableTypeGuardsFunction · 0.92
IntTypeAlias · 0.92
SingletonUnaryBindingFunction · 0.92
NewVariableFunction · 0.92
NewMapTypeFunction · 0.92
NewListTypeFunction · 0.92

Tested by

no test coverage detected