From e351533aab92362396e6c8940542fc74114f2074 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 25 Oct 2010 17:45:43 -0700 Subject: [PATCH] big: delete unnecessary type decls R=rsc, r CC=golang-dev https://golang.org/cl/2732041 --- src/pkg/big/arith_test.go | 20 ++++-------- src/pkg/big/int_test.go | 69 ++++++++++++--------------------------- src/pkg/big/nat_test.go | 28 +++++----------- src/pkg/big/rat_test.go | 24 +++++--------- 4 files changed, 44 insertions(+), 97 deletions(-) diff --git a/src/pkg/big/arith_test.go b/src/pkg/big/arith_test.go index 576bd5a09c2..5765b89d17a 100644 --- a/src/pkg/big/arith_test.go +++ b/src/pkg/big/arith_test.go @@ -300,15 +300,12 @@ func TestFunVWW(t *testing.T) { } -type mulWWTest struct { +var mulWWTests = []struct { x, y Word q, r Word -} - - -var mulWWTests = []mulWWTest{ +}{ {_M, _M, _M - 1, 1}, - // 32 bit only: mulWWTest{0xc47dfa8c, 50911, 0x98a4, 0x998587f4}, + // 32 bit only: {0xc47dfa8c, 50911, 0x98a4, 0x998587f4}, } @@ -322,16 +319,13 @@ func TestMulWW(t *testing.T) { } -type mulAddWWWTest struct { +var mulAddWWWTests = []struct { x, y, c Word q, r Word -} - - -var mulAddWWWTests = []mulAddWWWTest{ +}{ // TODO(agl): These will only work on 64-bit platforms. - // mulAddWWWTest{15064310297182388543, 0xe7df04d2d35d5d80, 13537600649892366549, 13644450054494335067, 10832252001440893781}, - // mulAddWWWTest{15064310297182388543, 0xdab2f18048baa68d, 13644450054494335067, 12869334219691522700, 14233854684711418382}, + // {15064310297182388543, 0xe7df04d2d35d5d80, 13537600649892366549, 13644450054494335067, 10832252001440893781}, + // {15064310297182388543, 0xdab2f18048baa68d, 13644450054494335067, 12869334219691522700, 14233854684711418382}, {_M, _M, 0, _M - 1, 1}, {_M, _M, _M, _M, 0}, } diff --git a/src/pkg/big/int_test.go b/src/pkg/big/int_test.go index 3a2f2a06575..818d0c6dbc6 100755 --- a/src/pkg/big/int_test.go +++ b/src/pkg/big/int_test.go @@ -186,13 +186,10 @@ func TestMul(t *testing.T) { } -type mulRangeZ struct { +var mulRangesZ = []struct { a, b int64 prod string -} - - -var mulRangesZ = []mulRangeZ{ +}{ // entirely positive ranges are covered by mulRangesN {-1, 1, "0"}, {-2, -1, "2"}, @@ -234,16 +231,13 @@ func TestMulRangeZ(t *testing.T) { } -type stringTest struct { +var stringTests = []struct { in string out string base int val int64 ok bool -} - - -var stringTests = []stringTest{ +}{ {in: "", ok: false}, {in: "a", ok: false}, {in: "z", ok: false}, @@ -353,15 +347,12 @@ func TestSetString(t *testing.T) { } -type divisionSignsTest struct { +// Examples from the Go Language Spec, section "Arithmetic operators" +var divisionSignsTests = []struct { x, y int64 q, r int64 // T-division d, m int64 // Euclidian division -} - - -// Examples from the Go Language Spec, section "Arithmetic operators" -var divisionSignsTests = []divisionSignsTest{ +}{ {5, 3, 1, 2, 1, 2}, {-5, 3, -1, -2, -2, 1}, {5, -3, -1, 2, -1, 2}, @@ -488,13 +479,10 @@ func checkQuo(x, y []byte) bool { } -type quoTest struct { +var quoTests = []struct { x, y string q, r string -} - - -var quoTests = []quoTest{ +}{ { "476217953993950760840509444250624797097991362735329973741718102894495832294430498335824897858659711275234906400899559094370964723884706254265559534144986498357", "9353930466774385905609975137998169297361893554149986716853295022578535724979483772383667534691121982974895531435241089241440253066816724367338287092081996", @@ -551,13 +539,10 @@ func TestQuoStepD6(t *testing.T) { } -type bitLenTest struct { +var bitLenTests = []struct { in string out int -} - - -var bitLenTests = []bitLenTest{ +}{ {"-1", 1}, {"0", 0}, {"1", 1}, @@ -588,13 +573,10 @@ func TestBitLen(t *testing.T) { } -type expTest struct { +var expTests = []struct { x, y, m string out string -} - - -var expTests = []expTest{ +}{ {"5", "0", "", "1"}, {"-5", "0", "", "-1"}, {"5", "1", "", "5"}, @@ -664,13 +646,10 @@ func checkGcd(aBytes, bBytes []byte) bool { } -type gcdTest struct { +var gcdTests = []struct { a, b int64 d, x, y int64 -} - - -var gcdTests = []gcdTest{ +}{ {120, 23, 1, -9, 47}, } @@ -928,12 +907,10 @@ func TestInt64(t *testing.T) { } -type bitwiseTest struct { +var bitwiseTests = []struct { x, y string and, or, xor, andNot string -} - -var bitwiseTests = []bitwiseTest{ +}{ {"0x00", "0x00", "0x00", "0x00", "0x00", "0x00"}, {"0x00", "0x01", "0x00", "0x01", "0x01", "0x00"}, {"0x01", "0x00", "0x00", "0x01", "0x01", "0x01"}, @@ -1019,12 +996,10 @@ func TestBitwise(t *testing.T) { } -type notTest struct { +var notTests = []struct { in string out string -} - -var notTests = []notTest{ +}{ {"0", "-1"}, {"1", "-2"}, {"7", "-8"}, @@ -1055,12 +1030,10 @@ func TestNot(t *testing.T) { } -type modInverseTest struct { +var modInverseTests = []struct { element string prime string -} - -var modInverseTests = []modInverseTest{ +}{ {"1", "7"}, {"1", "13"}, {"239487239847", "2410312426921032588552076022197566074856950548502459942654116941958108831682612228890093858261341614673227141477904012196503648957050582631942730706805009223062734745341073406696246014589361659774041027169249453200378729434170325843778659198143763193776859869524088940195577346119843545301547043747207749969763750084308926339295559968882457872412993810129130294592999947926365264059284647209730384947211681434464714438488520940127459844288859336526896320919633919"}, diff --git a/src/pkg/big/nat_test.go b/src/pkg/big/nat_test.go index 455d029ad95..0bcb945548a 100755 --- a/src/pkg/big/nat_test.go +++ b/src/pkg/big/nat_test.go @@ -6,13 +6,10 @@ package big import "testing" -type cmpTest struct { +var cmpTests = []struct { x, y nat r int -} - - -var cmpTests = []cmpTest{ +}{ {nil, nil, 0}, {nil, nat{}, 0}, {nat{}, nil, 0}, @@ -111,13 +108,10 @@ func TestFunNN(t *testing.T) { } -type mulRangeN struct { +var mulRangesN = []struct { a, b uint64 prod string -} - - -var mulRangesN = []mulRangeN{ +}{ {0, 0, "0"}, {1, 1, "1"}, {1, 2, "2"}, @@ -173,14 +167,11 @@ func BenchmarkMul(b *testing.B) { } -type str struct { +var tab = []struct { x nat b int s string -} - - -var tab = []str{ +}{ {nil, 10, "0"}, {nat{1}, 10, "1"}, {nat{10}, 10, "10"}, @@ -329,13 +320,10 @@ func TestTrailingZeroBits(t *testing.T) { } -type expNNTest struct { +var expNNTests = []struct { x, y, m string out string -} - - -var expNNTests = []expNNTest{ +}{ {"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"}, {"0x8000000000000000", "2", "6719", "4944"}, {"0x8000000000000000", "3", "6719", "5447"}, diff --git a/src/pkg/big/rat_test.go b/src/pkg/big/rat_test.go index b9f15ff9d65..460ed409e02 100644 --- a/src/pkg/big/rat_test.go +++ b/src/pkg/big/rat_test.go @@ -7,12 +7,10 @@ package big import "testing" -type setStringTest struct { +var setStringTests = []struct { in, out string ok bool -} - -var setStringTests = []setStringTest{ +}{ {"0", "0", true}, {"-0", "0", true}, {"1", "1", true}, @@ -55,13 +53,11 @@ func TestRatSetString(t *testing.T) { } -type floatStringTest struct { +var floatStringTests = []struct { in string prec int out string -} - -var floatStringTests = []floatStringTest{ +}{ {"0", 0, "0"}, {"0", 4, "0"}, {"1", 0, "1"}, @@ -103,12 +99,10 @@ func TestRatSign(t *testing.T) { } -type ratCmpTest struct { +var ratCmpTests = []struct { rat1, rat2 string out int -} - -var ratCmpTests = []ratCmpTest{ +}{ {"0", "0/1", 0}, {"1/1", "1", 0}, {"-1", "-2/2", 0}, @@ -182,12 +176,10 @@ func testRatBin(t *testing.T, i int, name string, f ratBinFun, a ratBinArg) { } -type ratBinTest struct { +var ratBinTests = []struct { x, y string sum, prod string -} - -var ratBinTests = []ratBinTest{ +}{ {"0", "0", "0", "0"}, {"0", "1", "1", "0"}, {"-1", "0", "-1", "0"},