summaryrefslogtreecommitdiff
path: root/libgo/go/compress/bzip2/bzip2_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-09-14 17:11:35 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 17:11:35 +0000
commitbc998d034f45d1828a8663b2eed928faf22a7d01 (patch)
tree8d262a22ca7318f4bcd64269fe8fe9e45bcf8d0f /libgo/go/compress/bzip2/bzip2_test.go
parenta41a6142df74219f596e612d3a7775f68ca6e96f (diff)
downloadgcc-bc998d034f45d1828a8663b2eed928faf22a7d01.tar.gz
libgo: update to go1.9
Reviewed-on: https://go-review.googlesource.com/63753 From-SVN: r252767
Diffstat (limited to 'libgo/go/compress/bzip2/bzip2_test.go')
-rw-r--r--libgo/go/compress/bzip2/bzip2_test.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/libgo/go/compress/bzip2/bzip2_test.go b/libgo/go/compress/bzip2/bzip2_test.go
index 95fb1895856..a6c3080db3e 100644
--- a/libgo/go/compress/bzip2/bzip2_test.go
+++ b/libgo/go/compress/bzip2/bzip2_test.go
@@ -204,6 +204,12 @@ func TestMTF(t *testing.T) {
}
}
+var (
+ digits = mustLoadFile("testdata/e.txt.bz2")
+ twain = mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt.bz2")
+ random = mustLoadFile("testdata/random.data.bz2")
+)
+
func benchmarkDecode(b *testing.B, compressed []byte) {
// Determine the uncompressed size of testfile.
uncompressedSize, err := io.Copy(ioutil.Discard, NewReader(bytes.NewReader(compressed)))
@@ -221,18 +227,6 @@ func benchmarkDecode(b *testing.B, compressed []byte) {
}
}
-func BenchmarkDecodeDigits(b *testing.B) {
- digits := mustLoadFile("testdata/e.txt.bz2")
- b.ResetTimer()
- benchmarkDecode(b, digits)
-}
-func BenchmarkDecodeTwain(b *testing.B) {
- twain := mustLoadFile("testdata/Mark.Twain-Tom.Sawyer.txt.bz2")
- b.ResetTimer()
- benchmarkDecode(b, twain)
-}
-func BenchmarkDecodeRand(b *testing.B) {
- random := mustLoadFile("testdata/random.data.bz2")
- b.ResetTimer()
- benchmarkDecode(b, random)
-}
+func BenchmarkDecodeDigits(b *testing.B) { benchmarkDecode(b, digits) }
+func BenchmarkDecodeTwain(b *testing.B) { benchmarkDecode(b, twain) }
+func BenchmarkDecodeRand(b *testing.B) { benchmarkDecode(b, random) }