aboutsummaryrefslogtreecommitdiff
path: root/ops_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-08 00:58:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-08 00:58:37 +0200
commit0420551036549f21eab1c1849eb68fe3440f408a (patch)
tree36d7649142d9f137d8b07fa351b5792121a9edba /ops_test.go
parentff06b99475a8ec7f5673e5f6e6701919e98f8b21 (diff)
Tweak testing
Diffstat (limited to 'ops_test.go')
-rw-r--r--ops_test.go32
1 files changed, 28 insertions, 4 deletions
diff --git a/ops_test.go b/ops_test.go
index cd907b3..2945447 100644
--- a/ops_test.go
+++ b/ops_test.go
@@ -3,25 +3,49 @@ package main
import "testing"
func TestAdd(t *testing.T) {
- if !verify("+", add) {
+ if _, ok := verify("+", add); !ok {
t.Error("add failed")
}
}
+func BenchmarkAdd(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ verify("+", add)
+ }
+}
+
func TestSub(t *testing.T) {
- if !verify("-", sub) {
+ if _, ok := verify("-", sub); !ok {
t.Error("sub failed")
}
}
+func BenchmarkSub(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ verify("-", sub)
+ }
+}
+
func TestTimes(t *testing.T) {
- if !verify("*", times) {
+ if _, ok := verify("*", times); !ok {
t.Error("times failed")
}
}
+func BenchmarkTimes(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ verify("*", times)
+ }
+}
+
func TestPot(t *testing.T) {
- if !verify("^", pot) {
+ if _, ok := verify("^", pot); !ok {
t.Error("pot failed")
}
}
+
+func BenchmarkPot(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ verify("^", pot)
+ }
+}