aboutsummaryrefslogtreecommitdiff
path: root/src/testing/benchmark_test.go
diff options
context:
space:
mode:
authorKatie Hockman <katie@golang.org>2020-12-14 10:03:05 -0500
committerKatie Hockman <katie@golang.org>2020-12-14 10:06:13 -0500
commit0345ede87ee12698988973884cfc0fd3d499dffd (patch)
tree7123cff141ee5661208d2f5f437b8f5252ac7f6a /src/testing/benchmark_test.go
parent4651d6b267818b0e0d128a5443289717c4bb8cbc (diff)
parent0a02371b0576964e81c3b40d328db9a3ef3b031b (diff)
downloadgo-0345ede87ee12698988973884cfc0fd3d499dffd.tar.xz
[dev.fuzz] all: merge master into dev.fuzz
Change-Id: I5d8c8329ccc9d747bd81ade6b1cb7cb8ae2e94b2
Diffstat (limited to 'src/testing/benchmark_test.go')
-rw-r--r--src/testing/benchmark_test.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/testing/benchmark_test.go b/src/testing/benchmark_test.go
index 1434c2613f..4c1cbd1933 100644
--- a/src/testing/benchmark_test.go
+++ b/src/testing/benchmark_test.go
@@ -22,13 +22,14 @@ var prettyPrintTests = []struct {
{0, " 0 x"},
{1234.1, " 1234 x"},
{-1234.1, " -1234 x"},
- {99.950001, " 100 x"},
- {99.949999, " 99.9 x"},
- {9.9950001, " 10.0 x"},
- {9.9949999, " 9.99 x"},
- {-9.9949999, " -9.99 x"},
- {0.0099950001, " 0.0100 x"},
- {0.0099949999, " 0.00999 x"},
+ {999.950001, " 1000 x"},
+ {999.949999, " 999.9 x"},
+ {99.9950001, " 100.0 x"},
+ {99.9949999, " 99.99 x"},
+ {-99.9949999, " -99.99 x"},
+ {0.000999950001, " 0.001000 x"},
+ {0.000999949999, " 0.0009999 x"}, // smallest case
+ {0.0000999949999, " 0.0001000 x"},
}
func TestPrettyPrint(t *testing.T) {
@@ -50,13 +51,13 @@ func TestResultString(t *testing.T) {
if r.NsPerOp() != 2 {
t.Errorf("NsPerOp: expected 2, actual %v", r.NsPerOp())
}
- if want, got := " 100\t 2.40 ns/op", r.String(); want != got {
+ if want, got := " 100\t 2.400 ns/op", r.String(); want != got {
t.Errorf("String: expected %q, actual %q", want, got)
}
// Test sub-1 ns/op (issue #31005)
r.T = 40 * time.Nanosecond
- if want, got := " 100\t 0.400 ns/op", r.String(); want != got {
+ if want, got := " 100\t 0.4000 ns/op", r.String(); want != got {
t.Errorf("String: expected %q, actual %q", want, got)
}
@@ -130,7 +131,7 @@ func TestReportMetric(t *testing.T) {
}
// Test stringing.
res.N = 1 // Make the output stable
- want := " 1\t 12345 ns/op\t 0.200 frobs/op"
+ want := " 1\t 12345 ns/op\t 0.2000 frobs/op"
if want != res.String() {
t.Errorf("expected %q, actual %q", want, res.String())
}