mirror of
https://github.com/golang/go
synced 2024-11-19 12:04:43 -07:00
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 <alb.donizetti@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
3d4c9cecc8
commit
331092c58f
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user