From 0420551036549f21eab1c1849eb68fe3440f408a Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 8 Apr 2015 00:58:37 +0200 Subject: Tweak testing --- ops_test.go | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'ops_test.go') 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) + } +} -- cgit v1.2.3