]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: apply a round of go vet
authorRobert Griesemer <gri@golang.org>
Wed, 25 Feb 2015 18:20:28 +0000 (10:20 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 25 Feb 2015 23:10:14 +0000 (23:10 +0000)
Change-Id: Ie8310acc783659497e50dfe629f06d655b51d647
Reviewed-on: https://go-review.googlesource.com/5990
Reviewed-by: Alan Donovan <adonovan@google.com>
src/math/big/float.go
src/math/big/int_test.go

index 29dbc0d8c291e81a221133c1db7051126a57f774..adb914d30e59785c1e38b9f7d95321357016178e 100644 (file)
@@ -292,7 +292,7 @@ func validate(x *Float) {
        if m == 0 {
                // 0.0 or Inf
                if x.exp != 0 && x.exp != infExp {
-                       panic(fmt.Sprintf("%empty matissa with invalid exponent %d", x.exp))
+                       panic(fmt.Sprintf("empty matissa with invalid exponent %d", x.exp))
                }
                return
        }
@@ -842,7 +842,7 @@ func (x *Float) Int(z *Int) (*Int, Accuracy) {
        return z, acc
 }
 
-// Rat returns the result of converting x into a quotient;
+// Rat returns the rational number corresponding to x;
 // or nil if x is an infinity.
 // If a non-nil *Rat argument z is provided, Rat stores
 // the result in z instead of allocating a new Rat.
index cb8c76bed1c9348b28df735afc919b91b6e4d907..dff8057cf9f5eb1fc6f22cd03f6cd736226e70a1 100644 (file)
@@ -290,15 +290,6 @@ func TestDivisionSigns(t *testing.T) {
        }
 }
 
-var bitsTests = []nat{
-       nil,
-       {0},
-       {1},
-       {0, 1, 2, 3, 4},
-       {4, 3, 2, 1, 0},
-       {4, 3, 2, 1, 0, 0, 0, 0},
-}
-
 func norm(x nat) nat {
        i := len(x)
        for i > 0 && x[i-1] == 0 {
@@ -308,7 +299,14 @@ func norm(x nat) nat {
 }
 
 func TestBits(t *testing.T) {
-       for _, test := range bitsTests {
+       for _, test := range []nat{
+               nil,
+               {0},
+               {1},
+               {0, 1, 2, 3, 4},
+               {4, 3, 2, 1, 0},
+               {4, 3, 2, 1, 0, 0, 0, 0},
+       } {
                var z Int
                z.neg = true
                got := z.SetBits(test)
@@ -318,7 +316,7 @@ func TestBits(t *testing.T) {
                }
 
                if got.neg {
-                       t.Errorf("SetBits(%v): got negative result")
+                       t.Errorf("SetBits(%v): got negative result", test)
                }
 
                bits := nat(z.Bits())