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

Function TestHashCall

interpreter/async_test.go:161–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func TestHashCall(t *testing.T) {
162 type hashInput struct {
163 id int64
164 overload string
165 args []ref.Val
166 }
167 tests := []struct {
168 name string
169 input hashInput
170 wantHash uint64
171 }{
172 {
173 name: "node id 1 with string arg a",
174 input: hashInput{1, overloads.ContainsString, []ref.Val{types.String("a")}},
175 wantHash: 13175600815575489707,
176 },
177 {
178 name: "node id 1 with string arg b",
179 input: hashInput{1, overloads.ContainsString, []ref.Val{types.String("b")}},
180 wantHash: 13172731090226426672,
181 },
182 {
183 name: "node id 1 with bool arg true",
184 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Bool(true)}},
185 wantHash: 5368363472817480916,
186 },
187 {
188 name: "node id 1 with bool arg false",
189 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Bool(false)}},
190 wantHash: 5369320047933835261,
191 },
192 {
193 name: "node id 1 with nil args",
194 input: hashInput{1, overloads.ContainsString, nil},
195 wantHash: 16571860343215109013,
196 },
197 {
198 name: "node id 2 with nil args",
199 input: hashInput{2, overloads.ContainsString, nil},
200 wantHash: 7332562693386296450,
201 },
202 {
203 name: "node id 1 with overload matches_string",
204 input: hashInput{1, overloads.MatchesString, nil},
205 wantHash: 6112375249444952169,
206 },
207 {
208 name: "node id 1 with overload starts_with_string",
209 input: hashInput{1, overloads.StartsWithString, nil},
210 wantHash: 17791913581187873402,
211 },
212 {
213 name: "node id 1 with int arg 1",
214 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Int(1)}},
215 wantHash: 6250879603390619476,
216 },
217 {
218 name: "node id 1 with uint arg 1",

Callers

nothing calls this directly

Calls 6

StringTypeAlias · 0.92
BoolTypeAlias · 0.92
IntTypeAlias · 0.92
UintTypeAlias · 0.92
DoubleTypeAlias · 0.92
hashCallFunction · 0.85

Tested by

no test coverage detected