testdata: Regenerate benchmark test data and add logging

This commit is contained in:
Joël Stemmer 2022-05-22 20:52:16 +01:00
parent b95e18cd5c
commit 5d691c7896
3 changed files with 30 additions and 11 deletions

View File

@ -1,7 +1,18 @@
goos: darwin
=== RUN TestOne
bench_test.go:9: test log
--- PASS: TestOne (0.00s)
goos: linux
goarch: amd64
pkg: code.internal/state
BenchmarkParse-8 2000000 604 ns/op
BenchmarkReadingList-8 1000000 1425 ns/op
pkg: package/bench
BenchmarkOne
bench_test.go:13: benchmark log (1)
bench_test.go:13: benchmark log (100)
bench_test.go:13: benchmark log (10000)
bench_test.go:13: benchmark log (1000000)
bench_test.go:13: benchmark log (100000000)
bench_test.go:13: benchmark log (1000000000)
BenchmarkOne-8 1000000000 0.2642 ns/op
BenchmarkTwo
BenchmarkTwo-8 39560503 33.21 ns/op
PASS
ok package/basic 3.212s
ok package/bench 1.640s

View File

@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite name="package/basic" tests="2" failures="0" errors="0" id="0" hostname="hostname" time="3.212" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="3">
<testsuite name="package/bench" tests="3" failures="0" errors="0" id="0" hostname="hostname" time="1.640" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="BenchmarkParse" classname="package/basic" time="1.208000000"></testcase>
<testcase name="BenchmarkReadingList" classname="package/basic" time="1.425000000"></testcase>
<system-out><![CDATA[goos: darwin
<testcase name="TestOne" classname="package/bench" time="0.000">
<system-out><![CDATA[ bench_test.go:9: test log]]></system-out>
</testcase>
<testcase name="BenchmarkOne" classname="package/bench" time="0.000000000"></testcase>
<testcase name="BenchmarkTwo" classname="package/bench" time="1.305496599"></testcase>
<system-out><![CDATA[goos: linux
goarch: amd64
pkg: code.internal/state]]></system-out>
pkg: package/bench]]></system-out>
</testsuite>
</testsuites>

View File

@ -5,7 +5,12 @@ import (
"testing"
)
func TestOne(t *testing.T) {
t.Logf("test log")
}
func BenchmarkOne(b *testing.B) {
b.Logf("benchmark log (%d)", b.N)
for i := 0; i < b.N; i++ {
test(i)
}