diff options
Diffstat (limited to 'src/lib/strconv/itoa_test.go')
| -rw-r--r-- | src/lib/strconv/itoa_test.go | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/lib/strconv/itoa_test.go b/src/lib/strconv/itoa_test.go index 880aff4a96..b0e4ed7fa9 100644 --- a/src/lib/strconv/itoa_test.go +++ b/src/lib/strconv/itoa_test.go @@ -11,47 +11,47 @@ import ( "testing"; ) -type Itoa64Test struct { +type itoa64Test struct { in int64; out string; } -var itoa64tests = []Itoa64Test { - Itoa64Test{ 0, "0" }, - Itoa64Test{ 1, "1" }, - Itoa64Test{ -1, "-1" }, - Itoa64Test{ 12345678, "12345678" }, - Itoa64Test{ -987654321, "-987654321" }, - Itoa64Test{ 1<<31-1, "2147483647" }, - Itoa64Test{ -1<<31+1, "-2147483647" }, - Itoa64Test{ 1<<31, "2147483648" }, - Itoa64Test{ -1<<31, "-2147483648" }, - Itoa64Test{ 1<<31+1, "2147483649" }, - Itoa64Test{ -1<<31-1, "-2147483649" }, - Itoa64Test{ 1<<32-1, "4294967295" }, - Itoa64Test{ -1<<32+1, "-4294967295" }, - Itoa64Test{ 1<<32, "4294967296" }, - Itoa64Test{ -1<<32, "-4294967296" }, - Itoa64Test{ 1<<32+1, "4294967297" }, - Itoa64Test{ -1<<32-1, "-4294967297" }, - Itoa64Test{ 1<<50, "1125899906842624" }, - Itoa64Test{ 1<<63-1, "9223372036854775807" }, - Itoa64Test{ -1<<63+1, "-9223372036854775807" }, - Itoa64Test{ -1<<63, "-9223372036854775808" }, +var itoa64tests = []itoa64Test { + itoa64Test{ 0, "0" }, + itoa64Test{ 1, "1" }, + itoa64Test{ -1, "-1" }, + itoa64Test{ 12345678, "12345678" }, + itoa64Test{ -987654321, "-987654321" }, + itoa64Test{ 1<<31-1, "2147483647" }, + itoa64Test{ -1<<31+1, "-2147483647" }, + itoa64Test{ 1<<31, "2147483648" }, + itoa64Test{ -1<<31, "-2147483648" }, + itoa64Test{ 1<<31+1, "2147483649" }, + itoa64Test{ -1<<31-1, "-2147483649" }, + itoa64Test{ 1<<32-1, "4294967295" }, + itoa64Test{ -1<<32+1, "-4294967295" }, + itoa64Test{ 1<<32, "4294967296" }, + itoa64Test{ -1<<32, "-4294967296" }, + itoa64Test{ 1<<32+1, "4294967297" }, + itoa64Test{ -1<<32-1, "-4294967297" }, + itoa64Test{ 1<<50, "1125899906842624" }, + itoa64Test{ 1<<63-1, "9223372036854775807" }, + itoa64Test{ -1<<63+1, "-9223372036854775807" }, + itoa64Test{ -1<<63, "-9223372036854775808" }, } export func TestItoa(t *testing.T) { for i := 0; i < len(itoa64tests); i++ { test := itoa64tests[i]; - s := strconv.itoa64(test.in); + s := strconv.Itoa64(test.in); if s != test.out { - t.Error("strconv.itoa64(%v) = %v want %v\n", + t.Error("strconv.Itoa64(%v) = %v want %v\n", test.in, s, test.out); } if int64(int(test.in)) == test.in { - s := strconv.itoa(int(test.in)); + s := strconv.Itoa(int(test.in)); if s != test.out { - t.Error("strconv.itoa(%v) = %v want %v\n", + t.Error("strconv.Itoa(%v) = %v want %v\n", test.in, s, test.out); } } @@ -59,17 +59,17 @@ export func TestItoa(t *testing.T) { } // TODO: Use once there is a strconv.uitoa -type Uitoa64Test struct { +type uitoa64Test struct { in uint64; out string; } // TODO: should be able to call this atoui64tests. -var uitoa64tests = []Uitoa64Test { - Uitoa64Test{ 1<<63-1, "9223372036854775807" }, - Uitoa64Test{ 1<<63, "9223372036854775808" }, - Uitoa64Test{ 1<<63+1, "9223372036854775809" }, - Uitoa64Test{ 1<<64-2, "18446744073709551614" }, - Uitoa64Test{ 1<<64-1, "18446744073709551615" }, +var uitoa64tests = []uitoa64Test { + uitoa64Test{ 1<<63-1, "9223372036854775807" }, + uitoa64Test{ 1<<63, "9223372036854775808" }, + uitoa64Test{ 1<<63+1, "9223372036854775809" }, + uitoa64Test{ 1<<64-2, "18446744073709551614" }, + uitoa64Test{ 1<<64-1, "18446744073709551615" }, } |
