MCPcopy
hub / github.com/google/mangle / TestEvalFloatPlus

Function TestEvalFloatPlus

functional/functional_test.go:22–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestEvalFloatPlus(t *testing.T) {
23 tests := []struct {
24 args []ast.BaseTerm
25 want ast.Constant
26 }{
27 {[]ast.BaseTerm{}, ast.Float64(0)},
28 {[]ast.BaseTerm{ast.Float64(1.5)}, ast.Float64(1.5)},
29 {[]ast.BaseTerm{ast.Float64(1.5), ast.Float64(2.5)}, ast.Float64(4.0)},
30 {[]ast.BaseTerm{ast.Number(2), ast.Float64(3.5)}, ast.Float64(5.5)},
31 {[]ast.BaseTerm{ast.Float64(2.5), ast.Number(1)}, ast.Float64(3.5)},
32 }
33 for _, test := range tests {
34 expr := ast.ApplyFn{symbols.FloatPlus, test.args}
35 got, err := EvalExpr(expr, ast.ConstSubstMap{})
36 if err != nil {
37 t.Errorf("EvalExpr(%v) error: %v", expr, err)
38 continue
39 }
40 if !got.Equals(test.want) {
41 t.Errorf("EvalExpr(%v) = %v, want %v", expr, got, test.want)
42 }
43 }
44}
45
46func TestListContains(t *testing.T) {
47 tests := []struct {

Callers

nothing calls this directly

Calls 4

Float64Function · 0.92
NumberFunction · 0.92
EvalExprFunction · 0.85
EqualsMethod · 0.65

Tested by

no test coverage detected