|
1 From 575890b1208780ae94406e3f0fa547cb7423656e Mon Sep 17 00:00:00 2001 |
|
2 From: Russ Cox <[email protected]> |
|
3 Date: Wed, 13 Jan 2016 13:38:17 -0500 |
|
4 Subject: [PATCH 72/73] [release-branch.go1.5] math/big: fix nat test |
|
5 |
|
6 Go 1.5 does not have nat.utoa(16) but has nat.hexString(). |
|
7 |
|
8 Change-Id: Iac91c8bf3c6cd404f255f75d237c2d3b84d99359 |
|
9 Reviewed-on: https://go-review.googlesource.com/18613 |
|
10 Run-TryBot: Russ Cox <[email protected]> |
|
11 Reviewed-by: Brad Fitzpatrick <[email protected]> |
|
12 Reviewed-by: Chris Broadfoot <[email protected]> |
|
13 --- |
|
14 src/math/big/nat_test.go | 8 ++++---- |
|
15 1 file changed, 4 insertions(+), 4 deletions(-) |
|
16 |
|
17 diff --git a/src/math/big/nat_test.go b/src/math/big/nat_test.go |
|
18 index dce7de5..13caec4 100644 |
|
19 --- a/src/math/big/nat_test.go |
|
20 +++ b/src/math/big/nat_test.go |
|
21 @@ -419,11 +419,11 @@ func TestMontgomery(t *testing.T) { |
|
22 |
|
23 if x.cmp(m) > 0 { |
|
24 _, r := nat(nil).div(nil, x, m) |
|
25 - t.Errorf("#%d: x > m (0x%s > 0x%s; use 0x%s)", i, x.utoa(16), m.utoa(16), r.utoa(16)) |
|
26 + t.Errorf("#%d: x > m (0x%s > 0x%s; use 0x%s)", i, x.hexString(), m.hexString(), r.hexString()) |
|
27 } |
|
28 if y.cmp(m) > 0 { |
|
29 _, r := nat(nil).div(nil, x, m) |
|
30 - t.Errorf("#%d: y > m (0x%s > 0x%s; use 0x%s)", i, y.utoa(16), m.utoa(16), r.utoa(16)) |
|
31 + t.Errorf("#%d: y > m (0x%s > 0x%s; use 0x%s)", i, y.hexString(), m.hexString(), r.hexString()) |
|
32 } |
|
33 |
|
34 var out nat |
|
35 @@ -441,7 +441,7 @@ func TestMontgomery(t *testing.T) { |
|
36 mi := &Int{abs: m} |
|
37 p := new(Int).Mod(new(Int).Mul(xi, new(Int).Mul(yi, new(Int).ModInverse(new(Int).Lsh(one, uint(len(m))*_W), mi))), mi) |
|
38 if out.cmp(p.abs.norm()) != 0 { |
|
39 - t.Errorf("#%d: out in table=0x%s, computed=0x%s", i, out.utoa(16), p.abs.norm().utoa(16)) |
|
40 + t.Errorf("#%d: out in table=0x%s, computed=0x%s", i, out.hexString(), p.abs.norm().hexString()) |
|
41 } |
|
42 |
|
43 // check k0 in table |
|
44 @@ -457,7 +457,7 @@ func TestMontgomery(t *testing.T) { |
|
45 z := nat(nil).montgomery(x, y, m, k0, len(m)) |
|
46 z = z.norm() |
|
47 if z.cmp(out) != 0 { |
|
48 - t.Errorf("#%d: got 0x%s want 0x%s", i, z.utoa(16), out.utoa(16)) |
|
49 + t.Errorf("#%d: got 0x%s want 0x%s", i, z.hexString(), out.hexString()) |
|
50 } |
|
51 } |
|
52 } |
|
53 -- |
|
54 2.6.1 |
|
55 |