From 331092c58f35d798ed92b04cb57c503c8ef3ad31 Mon Sep 17 00:00:00 2001 From: Alberto Donizetti Date: Wed, 10 Jan 2018 17:31:25 +0100 Subject: [PATCH] math/big: fix %s verbs in Float tests error messages Fatalf calls in two Float tests use the %s verb with Floats values, which is not allowed and results in failure messages that look like this: float_test.go:1385: i = 0, prec = 1, ToZero: %!s(*big.Float=1) [0] / %!s(*big.Float=1) [0] = %!s(*big.Float=0.0625) want %!s(*big.Float=1) Switch to %v. Change-Id: Ifdc80bf19c91ca1b190f6551a6d0a51b42ed5919 Reviewed-on: https://go-review.googlesource.com/87199 Run-TryBot: Alberto Donizetti Reviewed-by: Brad Fitzpatrick --- src/math/big/float_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/math/big/float_test.go b/src/math/big/float_test.go index 5fd49bb894..08da33779e 100644 --- a/src/math/big/float_test.go +++ b/src/math/big/float_test.go @@ -1372,7 +1372,7 @@ func TestFloatMul(t *testing.T) { got.Mul(x, y) want := zbits.round(prec, mode) if got.Cmp(want) != 0 { - t.Errorf("i = %d, prec = %d, %s:\n\t %s %v\n\t* %s %v\n\t= %s\n\twant %s", + t.Errorf("i = %d, prec = %d, %s:\n\t %v %v\n\t* %v %v\n\t= %v\n\twant %v", i, prec, mode, x, xbits, y, ybits, got, want) } @@ -1382,7 +1382,7 @@ func TestFloatMul(t *testing.T) { got.Quo(z, x) want = ybits.round(prec, mode) if got.Cmp(want) != 0 { - t.Errorf("i = %d, prec = %d, %s:\n\t %s %v\n\t/ %s %v\n\t= %s\n\twant %s", + t.Errorf("i = %d, prec = %d, %s:\n\t %v %v\n\t/ %v %v\n\t= %v\n\twant %v", i, prec, mode, z, zbits, x, xbits, got, want) } } @@ -1465,13 +1465,13 @@ func TestIssue6866(t *testing.T) { z2.Sub(two, p) if z1.Cmp(z2) != 0 { - t.Fatalf("prec %d: got z1 = %s != z2 = %s; want z1 == z2\n", prec, z1, z2) + t.Fatalf("prec %d: got z1 = %v != z2 = %v; want z1 == z2\n", prec, z1, z2) } if z1.Sign() != 0 { - t.Errorf("prec %d: got z1 = %s; want 0", prec, z1) + t.Errorf("prec %d: got z1 = %v; want 0", prec, z1) } if z2.Sign() != 0 { - t.Errorf("prec %d: got z2 = %s; want 0", prec, z2) + t.Errorf("prec %d: got z2 = %v; want 0", prec, z2) } } }