summaryrefslogtreecommitdiff
path: root/repeat_test.go
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2019-10-22 20:07:28 -0600
committermo khan <mo.khan@gmail.com>2019-10-22 20:07:28 -0600
commit5c49c8451057855b4ff7f75fa716c2953b1c3e2f (patch)
tree01e8b4f42e1920f4a46b550343e44e8ac94476f1 /repeat_test.go
parent6e627fd115529c309504a7518bcea5dacddaa049 (diff)
https://github.com/quii/learn-go-with-tests/blob/master/iteration.md#benchmarking
Diffstat (limited to 'repeat_test.go')
-rw-r--r--repeat_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/repeat_test.go b/repeat_test.go
index 37854a6..3ac6266 100644
--- a/repeat_test.go
+++ b/repeat_test.go
@@ -10,3 +10,9 @@ func TestRepeat(t *testing.T) {
t.Errorf("expected %q but got %q", expected, repeated)
}
}
+
+func BenchmarkRepeat(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ Repeat("a")
+ }
+}