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: 15814368891503067646,
176 },
177 {
178 name: "node id 1 with string arg b",
179 input: hashInput{1, overloads.ContainsString, []ref.Val{types.String("b")}},
180 wantHash: 15814368891503067647,
181 },
182 {
183 name: "node id 1 with bool arg true",
184 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Bool(true)}},
185 wantHash: 15814368891503067023,
186 },
187 {
188 name: "node id 1 with bool arg false",
189 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Bool(false)}},
190 wantHash: 15814368891503067022,
191 },
192 {
193 name: "node id 1 with nil args",
194 input: hashInput{1, overloads.ContainsString, nil},
195 wantHash: 2890365973752944208,
196 },
197 {
198 name: "node id 2 with nil args",
199 input: hashInput{2, overloads.ContainsString, nil},
200 wantHash: 2890365973752944239,
201 },
202 {
203 name: "node id 1 with overload matches_string",
204 input: hashInput{1, overloads.MatchesString, nil},
205 wantHash: 10829079174745334972,
206 },
207 {
208 name: "node id 1 with overload starts_with_string",
209 input: hashInput{1, overloads.StartsWithString, nil},
210 wantHash: 10228231960903522011,
211 },
212 {
213 name: "node id 1 with int arg 1",
214 input: hashInput{1, overloads.ContainsString, []ref.Val{types.Int(1)}},
215 wantHash: 1974807236593533186,
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