MCPcopy
hub / github.com/expr-lang/expr / TestIssue432

Function TestIssue432

expr_test.go:2392–2419  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2390}
2391
2392func TestIssue432(t *testing.T) {
2393 env := map[string]any{
2394 "func": func(
2395 paramUint32 uint32,
2396 paramUint16 uint16,
2397 paramUint8 uint8,
2398 paramUint uint,
2399 paramInt32 int32,
2400 paramInt16 int16,
2401 paramInt8 int8,
2402 paramInt int,
2403 paramFloat64 float64,
2404 paramFloat32 float32,
2405 ) float64 {
2406 return float64(paramUint32) + float64(paramUint16) + float64(paramUint8) + float64(paramUint) +
2407 float64(paramInt32) + float64(paramInt16) + float64(paramInt8) + float64(paramInt) +
2408 float64(paramFloat64) + float64(paramFloat32)
2409 },
2410 }
2411 code := `func(1,1,1,1,1,1,1,1,1,1)`
2412
2413 program, err := expr.Compile(code, expr.Env(env))
2414 assert.NoError(t, err)
2415
2416 out, err := expr.Run(program, env)
2417 assert.NoError(t, err)
2418 assert.Equal(t, float64(10), out)
2419}
2420
2421func TestIssue462(t *testing.T) {
2422 env := map[string]any{

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…