diff options
Diffstat (limited to 'src/pkg/big/int_test.go')
-rwxr-xr-x | src/pkg/big/int_test.go | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/pkg/big/int_test.go b/src/pkg/big/int_test.go index 58a55030d..7f33c9522 100755 --- a/src/pkg/big/int_test.go +++ b/src/pkg/big/int_test.go @@ -376,6 +376,35 @@ var formatTests = []struct { {"-10", "%#X", "-0XA"}, {"10", "%#y", "%!y(big.Int=10)"}, {"-10", "%#y", "%!y(big.Int=-10)"}, + + {"1234", "%d", "1234"}, + {"1234", "%3d", "1234"}, + {"1234", "%4d", "1234"}, + {"-1234", "%d", "-1234"}, + {"1234", "% 5d", " 1234"}, + {"1234", "%+5d", "+1234"}, + {"1234", "%-5d", "1234 "}, + {"1234", "%x", "4d2"}, + {"1234", "%X", "4D2"}, + {"1234", "% x", "4 d2"}, + {"-1234", "%3x", "-4d2"}, + {"-1234", "%4x", "-4d2"}, + {"-1234", "%5x", " -4d2"}, + {"-1234", "%-5x", "-4d2 "}, + {"-1234", "% x", "-4 d2"}, + {"1234", "%03d", "1234"}, + {"1234", "%04d", "1234"}, + {"1234", "%05d", "01234"}, + {"1234", "%06d", "001234"}, + {"-1234", "%06d", "-01234"}, + {"1234", "%+06d", "+01234"}, + {"1234", "% 06d", " 01234"}, + {"1234", "%-6d", "1234 "}, + {"1234", "%-06d", "001234"}, + {"-1234", "%-06d", "-01234"}, + {"10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", // 10**100 + "% x", + "12 49 ad 25 94 c3 7c eb 0b 27 84 c4 ce 0b f3 8a ce 40 8e 21 1a 7c aa b2 43 08 a8 2e 8f 10 00 00 00 00 00 00 00 00 00 00 00 00"}, } @@ -391,7 +420,7 @@ func TestFormat(t *testing.T) { } output := fmt.Sprintf(test.format, x) if output != test.output { - t.Errorf("#%d got %s; want %s", i, output, test.output) + t.Errorf("#%d got %q; want %q", i, output, test.output) } } } |