-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_math_test.go
33 lines (30 loc) · 1.79 KB
/
mod_math_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package dyntpl
import "testing"
func TestModMath(t *testing.T) {
t.Run("abs", func(t *testing.T) { testModWA(t, modArgs{"num": -123456}) })
t.Run("add", func(t *testing.T) { testModWA(t, modArgs{"num": 555}) })
t.Run("msub", func(t *testing.T) { testModWA(t, modArgs{"num": 555}) })
t.Run("inc", func(t *testing.T) { testModWA(t, modArgs{"num": 10}) })
t.Run("dec", func(t *testing.T) { testModWA(t, modArgs{"num": 10}) })
t.Run("mul", func(t *testing.T) { testModWA(t, modArgs{"num": 10}) })
t.Run("div", func(t *testing.T) { testModWA(t, modArgs{"num": 10}) })
t.Run("mod", func(t *testing.T) { testModWA(t, modArgs{"num": 10}) })
t.Run("rad", func(t *testing.T) { testModWA(t, modArgs{"num": 8}) })
t.Run("exp", func(t *testing.T) { testModWA(t, modArgs{"num": 5}) })
t.Run("log", func(t *testing.T) { testModWA(t, modArgs{"num": 6}) })
t.Run("fact", func(t *testing.T) { testModWA(t, modArgs{"num": 2}) })
}
func BenchmarkModMath(b *testing.B) {
b.Run("abs", func(b *testing.B) { benchModWA(b, modArgs{"num": -123456}) })
b.Run("add", func(b *testing.B) { benchModWA(b, modArgs{"num": 555}) })
b.Run("msub", func(b *testing.B) { benchModWA(b, modArgs{"num": 555}) })
b.Run("inc", func(b *testing.B) { benchModWA(b, modArgs{"num": 10}) })
b.Run("dec", func(b *testing.B) { benchModWA(b, modArgs{"num": 10}) })
b.Run("mul", func(b *testing.B) { benchModWA(b, modArgs{"num": 10}) })
b.Run("div", func(b *testing.B) { benchModWA(b, modArgs{"num": 10}) })
b.Run("mod", func(b *testing.B) { benchModWA(b, modArgs{"num": 10}) })
b.Run("rad", func(b *testing.B) { benchModWA(b, modArgs{"num": 8}) })
b.Run("exp", func(b *testing.B) { benchModWA(b, modArgs{"num": 5}) })
b.Run("log", func(b *testing.B) { benchModWA(b, modArgs{"num": 6}) })
b.Run("fact", func(b *testing.B) { benchModWA(b, modArgs{"num": 2}) })
}