summaryrefslogtreecommitdiffstats
path: root/tpl/math/math_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-06 14:12:10 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-07-06 17:51:38 +0200
commit2b8d907ab731627f4e2a30442cd729064516c8bb (patch)
tree2f9235dfbcf116c463b75d59c8be1be53d55b05a /tpl/math/math_test.go
parent43338c3a99769eb7d0df0c12559b8b3d42b67dba (diff)
Add a newScratch template func
Fixes #4685
Diffstat (limited to 'tpl/math/math_test.go')
-rw-r--r--tpl/math/math_test.go87
1 files changed, 0 insertions, 87 deletions
diff --git a/tpl/math/math_test.go b/tpl/math/math_test.go
index 97acfaeba..f2e6236af 100644
--- a/tpl/math/math_test.go
+++ b/tpl/math/math_test.go
@@ -56,93 +56,6 @@ func TestBasicNSArithmetic(t *testing.T) {
}
}
-func TestDoArithmetic(t *testing.T) {
- t.Parallel()
-
- for i, test := range []struct {
- a interface{}
- b interface{}
- op rune
- expect interface{}
- }{
- {3, 2, '+', int64(5)},
- {3, 2, '-', int64(1)},
- {3, 2, '*', int64(6)},
- {3, 2, '/', int64(1)},
- {3.0, 2, '+', float64(5)},
- {3.0, 2, '-', float64(1)},
- {3.0, 2, '*', float64(6)},
- {3.0, 2, '/', float64(1.5)},
- {3, 2.0, '+', float64(5)},
- {3, 2.0, '-', float64(1)},
- {3, 2.0, '*', float64(6)},
- {3, 2.0, '/', float64(1.5)},
- {3.0, 2.0, '+', float64(5)},
- {3.0, 2.0, '-', float64(1)},
- {3.0, 2.0, '*', float64(6)},
- {3.0, 2.0, '/', float64(1.5)},
- {uint(3), uint(2), '+', uint64(5)},
- {uint(3), uint(2), '-', uint64(1)},
- {uint(3), uint(2), '*', uint64(6)},
- {uint(3), uint(2), '/', uint64(1)},
- {uint(3), 2, '+', uint64(5)},
- {uint(3), 2, '-', uint64(1)},
- {uint(3), 2, '*', uint64(6)},
- {uint(3), 2, '/', uint64(1)},
- {3, uint(2), '+', uint64(5)},
- {3, uint(2), '-', uint64(1)},
- {3, uint(2), '*', uint64(6)},
- {3, uint(2), '/', uint64(1)},
- {uint(3), -2, '+', int64(1)},
- {uint(3), -2, '-', int64(5)},
- {uint(3), -2, '*', int64(-6)},
- {uint(3), -2, '/', int64(-1)},
- {-3, uint(2), '+', int64(-1)},
- {-3, uint(2), '-', int64(-5)},
- {-3, uint(2), '*', int64(-6)},
- {-3, uint(2), '/', int64(-1)},
- {uint(3), 2.0, '+', float64(5)},
- {uint(3), 2.0, '-', float64(1)},
- {uint(3), 2.0, '*', float64(6)},
- {uint(3), 2.0, '/', float64(1.5)},
- {3.0, uint(2), '+', float64(5)},
- {3.0, uint(2), '-', float64(1)},
- {3.0, uint(2), '*', float64(6)},
- {3.0, uint(2), '/', float64(1.5)},
- {0, 0, '+', 0},
- {0, 0, '-', 0},
- {0, 0, '*', 0},
- {"foo", "bar", '+', "foobar"},
- {3, 0, '/', false},
- {3.0, 0, '/', false},
- {3, 0.0, '/', false},
- {uint(3), uint(0), '/', false},
- {3, uint(0), '/', false},
- {-3, uint(0), '/', false},
- {uint(3), 0, '/', false},
- {3.0, uint(0), '/', false},
- {uint(3), 0.0, '/', false},
- {3, "foo", '+', false},
- {3.0, "foo", '+', false},
- {uint(3), "foo", '+', false},
- {"foo", 3, '+', false},
- {"foo", "bar", '-', false},
- {3, 2, '%', false},
- } {
- errMsg := fmt.Sprintf("[%d] %v", i, test)
-
- result, err := DoArithmetic(test.a, test.b, test.op)
-
- if b, ok := test.expect.(bool); ok && !b {
- require.Error(t, err, errMsg)
- continue
- }
-
- require.NoError(t, err, errMsg)
- assert.Equal(t, test.expect, result, errMsg)
- }
-}
-
func TestCeil(t *testing.T) {
t.Parallel()