aboutsummaryrefslogtreecommitdiff
path: root/src/lib/strconv
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-03-03 08:39:12 -0800
committerRuss Cox <rsc@golang.org>2009-03-03 08:39:12 -0800
commitbe2edb57614dd5a92294b7d29a34de754998fde5 (patch)
tree028f4f1a5f6b78795c1a1ef840b49c7da342edd1 /src/lib/strconv
parente8b43190bbec4b3b445739c216a0f4e023a9442f (diff)
downloadgo-be2edb57614dd5a92294b7d29a34de754998fde5.tar.xz
Automated g4 rollback of changelist 25024,
plus significant hand editing. Back to T{x} for composite literals. R=r OCL=25612 CL=25632
Diffstat (limited to 'src/lib/strconv')
-rw-r--r--src/lib/strconv/atof.go12
-rw-r--r--src/lib/strconv/atof_test.go110
-rw-r--r--src/lib/strconv/atoi_test.go158
-rw-r--r--src/lib/strconv/decimal.go60
-rw-r--r--src/lib/strconv/decimal_test.go76
-rw-r--r--src/lib/strconv/ftoa.go4
-rw-r--r--src/lib/strconv/ftoa_test.go116
-rw-r--r--src/lib/strconv/itoa_test.go89
-rw-r--r--src/lib/strconv/quote_test.go96
9 files changed, 360 insertions, 361 deletions
diff --git a/src/lib/strconv/atof.go b/src/lib/strconv/atof.go
index d1a0f4a9e7..3585944163 100644
--- a/src/lib/strconv/atof.go
+++ b/src/lib/strconv/atof.go
@@ -106,9 +106,9 @@ func stringToDecimal(s string) (neg bool, d *decimal, trunc bool, ok bool) {
}
// decimal power of ten to binary power of two.
-var powtab = []int(
+var powtab = []int{
1, 3, 6, 9, 13, 16, 19, 23, 26
-)
+}
func decimalToFloatBits(neg bool, d *decimal, trunc bool, flt *floatInfo) (b uint64, overflow bool) {
var exp int;
@@ -232,14 +232,14 @@ func decimalAtof32Int(neg bool, d *decimal) float32 {
}
// Exact powers of 10.
-var float64pow10 = []float64 (
+var float64pow10 = []float64 {
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22
-)
-var float32pow10 = []float32 (
+}
+var float32pow10 = []float32 {
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10
-)
+}
// If possible to convert decimal d to 64-bit float f exactly,
// entirely in floating-point math, do so, avoiding the expense of decimalToFloatBits.
diff --git a/src/lib/strconv/atof_test.go b/src/lib/strconv/atof_test.go
index abc1998714..7f1f0a1312 100644
--- a/src/lib/strconv/atof_test.go
+++ b/src/lib/strconv/atof_test.go
@@ -16,80 +16,80 @@ type atofTest struct {
err *os.Error;
}
-var atoftests = []atofTest (
- atofTest( "", "0", os.EINVAL ),
- atofTest( "1", "1", nil ),
- atofTest( "+1", "1", nil ),
- atofTest( "1x", "0", os.EINVAL ),
- atofTest( "1.1.", "0", os.EINVAL ),
- atofTest( "1e23", "1e+23", nil ),
- atofTest( "100000000000000000000000", "1e+23", nil ),
- atofTest( "1e-100", "1e-100", nil ),
- atofTest( "123456700", "1.234567e+08", nil ),
- atofTest( "99999999999999974834176", "9.999999999999997e+22", nil ),
- atofTest( "100000000000000000000001", "1.0000000000000001e+23", nil ),
- atofTest( "100000000000000008388608", "1.0000000000000001e+23", nil ),
- atofTest( "100000000000000016777215", "1.0000000000000001e+23", nil ),
- atofTest( "100000000000000016777216", "1.0000000000000003e+23", nil ),
- atofTest( "-1", "-1", nil ),
- atofTest( "-0", "-0", nil ),
- atofTest( "1e-20", "1e-20", nil ),
- atofTest( "625e-3", "0.625", nil ),
+var atoftests = []atofTest {
+ atofTest{ "", "0", os.EINVAL },
+ atofTest{ "1", "1", nil },
+ atofTest{ "+1", "1", nil },
+ atofTest{ "1x", "0", os.EINVAL },
+ atofTest{ "1.1.", "0", os.EINVAL },
+ atofTest{ "1e23", "1e+23", nil },
+ atofTest{ "100000000000000000000000", "1e+23", nil },
+ atofTest{ "1e-100", "1e-100", nil },
+ atofTest{ "123456700", "1.234567e+08", nil },
+ atofTest{ "99999999999999974834176", "9.999999999999997e+22", nil },
+ atofTest{ "100000000000000000000001", "1.0000000000000001e+23", nil },
+ atofTest{ "100000000000000008388608", "1.0000000000000001e+23", nil },
+ atofTest{ "100000000000000016777215", "1.0000000000000001e+23", nil },
+ atofTest{ "100000000000000016777216", "1.0000000000000003e+23", nil },
+ atofTest{ "-1", "-1", nil },
+ atofTest{ "-0", "-0", nil },
+ atofTest{ "1e-20", "1e-20", nil },
+ atofTest{ "625e-3", "0.625", nil },
// largest float64
- atofTest( "1.7976931348623157e308", "1.7976931348623157e+308", nil ),
- atofTest( "-1.7976931348623157e308", "-1.7976931348623157e+308", nil ),
+ atofTest{ "1.7976931348623157e308", "1.7976931348623157e+308", nil },
+ atofTest{ "-1.7976931348623157e308", "-1.7976931348623157e+308", nil },
// next float64 - too large
- atofTest( "1.7976931348623159e308", "+Inf", os.ERANGE ),
- atofTest( "-1.7976931348623159e308", "-Inf", os.ERANGE ),
+ atofTest{ "1.7976931348623159e308", "+Inf", os.ERANGE },
+ atofTest{ "-1.7976931348623159e308", "-Inf", os.ERANGE },
// the border is ...158079
// borderline - okay
- atofTest( "1.7976931348623158e308", "1.7976931348623157e+308", nil ),
- atofTest( "-1.7976931348623158e308", "-1.7976931348623157e+308", nil ),
+ atofTest{ "1.7976931348623158e308", "1.7976931348623157e+308", nil },
+ atofTest{ "-1.7976931348623158e308", "-1.7976931348623157e+308", nil },
// borderline - too large
- atofTest( "1.797693134862315808e308", "+Inf", os.ERANGE ),
- atofTest( "-1.797693134862315808e308", "-Inf", os.ERANGE ),
+ atofTest{ "1.797693134862315808e308", "+Inf", os.ERANGE },
+ atofTest{ "-1.797693134862315808e308", "-Inf", os.ERANGE },
// a little too large
- atofTest( "1e308", "1e+308", nil ),
- atofTest( "2e308", "+Inf", os.ERANGE ),
- atofTest( "1e309", "+Inf", os.ERANGE ),
+ atofTest{ "1e308", "1e+308", nil },
+ atofTest{ "2e308", "+Inf", os.ERANGE },
+ atofTest{ "1e309", "+Inf", os.ERANGE },
// way too large
- atofTest( "1e310", "+Inf", os.ERANGE ),
- atofTest( "-1e310", "-Inf", os.ERANGE ),
- atofTest( "1e400", "+Inf", os.ERANGE ),
- atofTest( "-1e400", "-Inf", os.ERANGE ),
- atofTest( "1e400000", "+Inf", os.ERANGE ),
- atofTest( "-1e400000", "-Inf", os.ERANGE ),
+ atofTest{ "1e310", "+Inf", os.ERANGE },
+ atofTest{ "-1e310", "-Inf", os.ERANGE },
+ atofTest{ "1e400", "+Inf", os.ERANGE },
+ atofTest{ "-1e400", "-Inf", os.ERANGE },
+ atofTest{ "1e400000", "+Inf", os.ERANGE },
+ atofTest{ "-1e400000", "-Inf", os.ERANGE },
// denormalized
- atofTest( "1e-305", "1e-305", nil ),
- atofTest( "1e-306", "1e-306", nil ),
- atofTest( "1e-307", "1e-307", nil ),
- atofTest( "1e-308", "1e-308", nil ),
- atofTest( "1e-309", "1e-309", nil ),
- atofTest( "1e-310", "1e-310", nil ),
- atofTest( "1e-322", "1e-322", nil ),
+ atofTest{ "1e-305", "1e-305", nil },
+ atofTest{ "1e-306", "1e-306", nil },
+ atofTest{ "1e-307", "1e-307", nil },
+ atofTest{ "1e-308", "1e-308", nil },
+ atofTest{ "1e-309", "1e-309", nil },
+ atofTest{ "1e-310", "1e-310", nil },
+ atofTest{ "1e-322", "1e-322", nil },
// smallest denormal
- atofTest( "5e-324", "5e-324", nil ),
+ atofTest{ "5e-324", "5e-324", nil },
// too small
- atofTest( "4e-324", "0", nil ),
+ atofTest{ "4e-324", "0", nil },
// way too small
- atofTest( "1e-350", "0", nil ),
- atofTest( "1e-400000", "0", nil ),
+ atofTest{ "1e-350", "0", nil },
+ atofTest{ "1e-400000", "0", nil },
// try to overflow exponent
- atofTest( "1e-4294967296", "0", nil ),
- atofTest( "1e+4294967296", "+Inf", os.ERANGE ),
- atofTest( "1e-18446744073709551616", "0", nil ),
- atofTest( "1e+18446744073709551616", "+Inf", os.ERANGE ),
+ atofTest{ "1e-4294967296", "0", nil },
+ atofTest{ "1e+4294967296", "+Inf", os.ERANGE },
+ atofTest{ "1e-18446744073709551616", "0", nil },
+ atofTest{ "1e+18446744073709551616", "+Inf", os.ERANGE },
// Parse errors
- atofTest( "1e", "0", os.EINVAL ),
- atofTest( "1e-", "0", os.EINVAL ),
- atofTest( ".e-1", "0", os.EINVAL ),
-)
+ atofTest{ "1e", "0", os.EINVAL },
+ atofTest{ "1e-", "0", os.EINVAL },
+ atofTest{ ".e-1", "0", os.EINVAL },
+}
func testAtof(t *testing.T, opt bool) {
oldopt := strconv.optimize;
diff --git a/src/lib/strconv/atoi_test.go b/src/lib/strconv/atoi_test.go
index 0128eb70b6..3940ebc782 100644
--- a/src/lib/strconv/atoi_test.go
+++ b/src/lib/strconv/atoi_test.go
@@ -17,26 +17,26 @@ type atoui64Test struct {
err *os.Error;
}
-var atoui64tests = []atoui64Test (
- atoui64Test("", 0, os.EINVAL),
- atoui64Test("0", 0, nil),
- atoui64Test("1", 1, nil),
- atoui64Test("12345", 12345, nil),
- atoui64Test("012345", 012345, nil),
- atoui64Test("0x12345", 0x12345, nil),
- atoui64Test("0X12345", 0x12345, nil),
- atoui64Test("12345x", 0, os.EINVAL),
- atoui64Test("98765432100", 98765432100, nil),
- atoui64Test("18446744073709551615", 1<<64-1, nil),
- atoui64Test("18446744073709551616", 1<<64-1, os.ERANGE),
- atoui64Test("18446744073709551620", 1<<64-1, os.ERANGE),
- atoui64Test("0xFFFFFFFFFFFFFFFF", 1<<64-1, nil),
- atoui64Test("0x10000000000000000", 1<<64-1, os.ERANGE),
- atoui64Test("01777777777777777777777", 1<<64-1, nil),
- atoui64Test("01777777777777777777778", 0, os.EINVAL),
- atoui64Test("02000000000000000000000", 1<<64-1, os.ERANGE),
- atoui64Test("0200000000000000000000", 1<<61, nil),
-)
+var atoui64tests = []atoui64Test {
+ atoui64Test{"", 0, os.EINVAL},
+ atoui64Test{"0", 0, nil},
+ atoui64Test{"1", 1, nil},
+ atoui64Test{"12345", 12345, nil},
+ atoui64Test{"012345", 012345, nil},
+ atoui64Test{"0x12345", 0x12345, nil},
+ atoui64Test{"0X12345", 0x12345, nil},
+ atoui64Test{"12345x", 0, os.EINVAL},
+ atoui64Test{"98765432100", 98765432100, nil},
+ atoui64Test{"18446744073709551615", 1<<64-1, nil},
+ atoui64Test{"18446744073709551616", 1<<64-1, os.ERANGE},
+ atoui64Test{"18446744073709551620", 1<<64-1, os.ERANGE},
+ atoui64Test{"0xFFFFFFFFFFFFFFFF", 1<<64-1, nil},
+ atoui64Test{"0x10000000000000000", 1<<64-1, os.ERANGE},
+ atoui64Test{"01777777777777777777777", 1<<64-1, nil},
+ atoui64Test{"01777777777777777777778", 0, os.EINVAL},
+ atoui64Test{"02000000000000000000000", 1<<64-1, os.ERANGE},
+ atoui64Test{"0200000000000000000000", 1<<61, nil},
+}
type atoi64Test struct {
in string;
@@ -44,29 +44,29 @@ type atoi64Test struct {
err *os.Error;
}
-var atoi64test = []atoi64Test (
- atoi64Test("", 0, os.EINVAL),
- atoi64Test("0", 0, nil),
- atoi64Test("-0", 0, nil),
- atoi64Test("1", 1, nil),
- atoi64Test("-1", -1, nil),
- atoi64Test("12345", 12345, nil),
- atoi64Test("-12345", -12345, nil),
- atoi64Test("012345", 012345, nil),
- atoi64Test("-012345", -012345, nil),
- atoi64Test("0x12345", 0x12345, nil),
- atoi64Test("-0X12345", -0x12345, nil),
- atoi64Test("12345x", 0, os.EINVAL),
- atoi64Test("-12345x", 0, os.EINVAL),
- atoi64Test("98765432100", 98765432100, nil),
- atoi64Test("-98765432100", -98765432100, nil),
- atoi64Test("9223372036854775807", 1<<63-1, nil),
- atoi64Test("-9223372036854775807", -(1<<63-1), nil),
- atoi64Test("9223372036854775808", 1<<63-1, os.ERANGE),
- atoi64Test("-9223372036854775808", -1<<63, nil),
- atoi64Test("9223372036854775809", 1<<63-1, os.ERANGE),
- atoi64Test("-9223372036854775809", -1<<63, os.ERANGE),
-)
+var atoi64test = []atoi64Test {
+ atoi64Test{"", 0, os.EINVAL},
+ atoi64Test{"0", 0, nil},
+ atoi64Test{"-0", 0, nil},
+ atoi64Test{"1", 1, nil},
+ atoi64Test{"-1", -1, nil},
+ atoi64Test{"12345", 12345, nil},
+ atoi64Test{"-12345", -12345, nil},
+ atoi64Test{"012345", 012345, nil},
+ atoi64Test{"-012345", -012345, nil},
+ atoi64Test{"0x12345", 0x12345, nil},
+ atoi64Test{"-0X12345", -0x12345, nil},
+ atoi64Test{"12345x", 0, os.EINVAL},
+ atoi64Test{"-12345x", 0, os.EINVAL},
+ atoi64Test{"98765432100", 98765432100, nil},
+ atoi64Test{"-98765432100", -98765432100, nil},
+ atoi64Test{"9223372036854775807", 1<<63-1, nil},
+ atoi64Test{"-9223372036854775807", -(1<<63-1), nil},
+ atoi64Test{"9223372036854775808", 1<<63-1, os.ERANGE},
+ atoi64Test{"-9223372036854775808", -1<<63, nil},
+ atoi64Test{"9223372036854775809", 1<<63-1, os.ERANGE},
+ atoi64Test{"-9223372036854775809", -1<<63, os.ERANGE},
+}
type atoui32Test struct {
in string;
@@ -74,19 +74,19 @@ type atoui32Test struct {
err *os.Error;
}
-var atoui32tests = []atoui32Test (
- atoui32Test("", 0, os.EINVAL),
- atoui32Test("0", 0, nil),
- atoui32Test("1", 1, nil),
- atoui32Test("12345", 12345, nil),
- atoui32Test("012345", 012345, nil),
- atoui32Test("0x12345", 0x12345, nil),
- atoui32Test("0X12345", 0x12345, nil),
- atoui32Test("12345x", 0, os.EINVAL),
- atoui32Test("987654321", 987654321, nil),
- atoui32Test("4294967295", 1<<32-1, nil),
- atoui32Test("4294967296", 1<<32-1, os.ERANGE),
-)
+var atoui32tests = []atoui32Test {
+ atoui32Test{"", 0, os.EINVAL},
+ atoui32Test{"0", 0, nil},
+ atoui32Test{"1", 1, nil},
+ atoui32Test{"12345", 12345, nil},
+ atoui32Test{"012345", 012345, nil},
+ atoui32Test{"0x12345", 0x12345, nil},
+ atoui32Test{"0X12345", 0x12345, nil},
+ atoui32Test{"12345x", 0, os.EINVAL},
+ atoui32Test{"987654321", 987654321, nil},
+ atoui32Test{"4294967295", 1<<32-1, nil},
+ atoui32Test{"4294967296", 1<<32-1, os.ERANGE},
+}
type atoi32Test struct {
in string;
@@ -94,29 +94,29 @@ type atoi32Test struct {
err *os.Error;
}
-var atoi32tests = []atoi32Test (
- atoi32Test("", 0, os.EINVAL),
- atoi32Test("0", 0, nil),
- atoi32Test("-0", 0, nil),
- atoi32Test("1", 1, nil),
- atoi32Test("-1", -1, nil),
- atoi32Test("12345", 12345, nil),
- atoi32Test("-12345", -12345, nil),
- atoi32Test("012345", 012345, nil),
- atoi32Test("-012345", -012345, nil),
- atoi32Test("0x12345", 0x12345, nil),
- atoi32Test("-0X12345", -0x12345, nil),
- atoi32Test("12345x", 0, os.EINVAL),
- atoi32Test("-12345x", 0, os.EINVAL),
- atoi32Test("987654321", 987654321, nil),
- atoi32Test("-987654321", -987654321, nil),
- atoi32Test("2147483647", 1<<31-1, nil),
- atoi32Test("-2147483647", -(1<<31-1), nil),
- atoi32Test("2147483648", 1<<31-1, os.ERANGE),
- atoi32Test("-2147483648", -1<<31, nil),
- atoi32Test("2147483649", 1<<31-1, os.ERANGE),
- atoi32Test("-2147483649", -1<<31, os.ERANGE),
-)
+var atoi32tests = []atoi32Test {
+ atoi32Test{"", 0, os.EINVAL},
+ atoi32Test{"0", 0, nil},
+ atoi32Test{"-0", 0, nil},
+ atoi32Test{"1", 1, nil},
+ atoi32Test{"-1", -1, nil},
+ atoi32Test{"12345", 12345, nil},
+ atoi32Test{"-12345", -12345, nil},
+ atoi32Test{"012345", 012345, nil},
+ atoi32Test{"-012345", -012345, nil},
+ atoi32Test{"0x12345", 0x12345, nil},
+ atoi32Test{"-0X12345", -0x12345, nil},
+ atoi32Test{"12345x", 0, os.EINVAL},
+ atoi32Test{"-12345x", 0, os.EINVAL},
+ atoi32Test{"987654321", 987654321, nil},
+ atoi32Test{"-987654321", -987654321, nil},
+ atoi32Test{"2147483647", 1<<31-1, nil},
+ atoi32Test{"-2147483647", -(1<<31-1), nil},
+ atoi32Test{"2147483648", 1<<31-1, os.ERANGE},
+ atoi32Test{"-2147483648", -1<<31, nil},
+ atoi32Test{"2147483649", 1<<31-1, os.ERANGE},
+ atoi32Test{"-2147483649", -1<<31, os.ERANGE},
+}
func TestAtoui64(t *testing.T) {
for i := 0; i < len(atoui64tests); i++ {
diff --git a/src/lib/strconv/decimal.go b/src/lib/strconv/decimal.go
index 37a5ab9c6b..4808e93463 100644
--- a/src/lib/strconv/decimal.go
+++ b/src/lib/strconv/decimal.go
@@ -192,7 +192,7 @@ type leftCheat struct {
cutoff string; // minus one digit if original < a.
}
-var leftcheats = []leftCheat (
+var leftcheats = []leftCheat {
// Leading digits of 1/2^i = 5^i.
// 5^23 is not an exact 64-bit floating point number,
// so have to use bc for the math.
@@ -205,35 +205,35 @@ var leftcheats = []leftCheat (
int(log2*NR+1), $0, 2**NR)
}'
*/
- leftCheat( 0, "" ),
- leftCheat( 1, "5" ), // * 2
- leftCheat( 1, "25" ), // * 4
- leftCheat( 1, "125" ), // * 8
- leftCheat( 2, "625" ), // * 16
- leftCheat( 2, "3125" ), // * 32
- leftCheat( 2, "15625" ), // * 64
- leftCheat( 3, "78125" ), // * 128
- leftCheat( 3, "390625" ), // * 256
- leftCheat( 3, "1953125" ), // * 512
- leftCheat( 4, "9765625" ), // * 1024
- leftCheat( 4, "48828125" ), // * 2048
- leftCheat( 4, "244140625" ), // * 4096
- leftCheat( 4, "1220703125" ), // * 8192
- leftCheat( 5, "6103515625" ), // * 16384
- leftCheat( 5, "30517578125" ), // * 32768
- leftCheat( 5, "152587890625" ), // * 65536
- leftCheat( 6, "762939453125" ), // * 131072
- leftCheat( 6, "3814697265625" ), // * 262144
- leftCheat( 6, "19073486328125" ), // * 524288
- leftCheat( 7, "95367431640625" ), // * 1048576
- leftCheat( 7, "476837158203125" ), // * 2097152
- leftCheat( 7, "2384185791015625" ), // * 4194304
- leftCheat( 7, "11920928955078125" ), // * 8388608
- leftCheat( 8, "59604644775390625" ), // * 16777216
- leftCheat( 8, "298023223876953125" ), // * 33554432
- leftCheat( 8, "1490116119384765625" ), // * 67108864
- leftCheat( 9, "7450580596923828125" ), // * 134217728
-)
+ leftCheat{ 0, "" },
+ leftCheat{ 1, "5" }, // * 2
+ leftCheat{ 1, "25" }, // * 4
+ leftCheat{ 1, "125" }, // * 8
+ leftCheat{ 2, "625" }, // * 16
+ leftCheat{ 2, "3125" }, // * 32
+ leftCheat{ 2, "15625" }, // * 64
+ leftCheat{ 3, "78125" }, // * 128
+ leftCheat{ 3, "390625" }, // * 256
+ leftCheat{ 3, "1953125" }, // * 512
+ leftCheat{ 4, "9765625" }, // * 1024
+ leftCheat{ 4, "48828125" }, // * 2048
+ leftCheat{ 4, "244140625" }, // * 4096
+ leftCheat{ 4, "1220703125" }, // * 8192
+ leftCheat{ 5, "6103515625" }, // * 16384
+ leftCheat{ 5, "30517578125" }, // * 32768
+ leftCheat{ 5, "152587890625" }, // * 65536
+ leftCheat{ 6, "762939453125" }, // * 131072
+ leftCheat{ 6, "3814697265625" }, // * 262144
+ leftCheat{ 6, "19073486328125" }, // * 524288
+ leftCheat{ 7, "95367431640625" }, // * 1048576
+ leftCheat{ 7, "476837158203125" }, // * 2097152
+ leftCheat{ 7, "2384185791015625" }, // * 4194304
+ leftCheat{ 7, "11920928955078125" }, // * 8388608
+ leftCheat{ 8, "59604644775390625" }, // * 16777216
+ leftCheat{ 8, "298023223876953125" }, // * 33554432
+ leftCheat{ 8, "1490116119384765625" }, // * 67108864
+ leftCheat{ 9, "7450580596923828125" }, // * 134217728
+}
// Is the leading prefix of b lexicographically less than s?
func prefixIsLessThan(b []byte, s string) bool {
diff --git a/src/lib/strconv/decimal_test.go b/src/lib/strconv/decimal_test.go
index 7af0d254d0..bc82861bdd 100644
--- a/src/lib/strconv/decimal_test.go
+++ b/src/lib/strconv/decimal_test.go
@@ -16,18 +16,18 @@ type shiftTest struct {
out string;
}
-var shifttests = []shiftTest (
- shiftTest( 0, -100, "0" ),
- shiftTest( 0, 100, "0" ),
- shiftTest( 1, 100, "1267650600228229401496703205376" ),
- shiftTest( 1, -100,
+var shifttests = []shiftTest {
+ shiftTest{ 0, -100, "0" },
+ shiftTest{ 0, 100, "0" },
+ shiftTest{ 1, 100, "1267650600228229401496703205376" },
+ shiftTest{ 1, -100,
"0.00000000000000000000000000000078886090522101180541"
- "17285652827862296732064351090230047702789306640625" ),
- shiftTest( 12345678, 8, "3160493568" ),
- shiftTest( 12345678, -8, "48225.3046875" ),
- shiftTest( 195312, 9, "99999744" ),
- shiftTest( 1953125, 9, "1000000000" ),
-)
+ "17285652827862296732064351090230047702789306640625" },
+ shiftTest{ 12345678, 8, "3160493568" },
+ shiftTest{ 12345678, -8, "48225.3046875" },
+ shiftTest{ 195312, 9, "99999744" },
+ shiftTest{ 1953125, 9, "1000000000" },
+}
func TestDecimalShift(t *testing.T) {
ok := true;
@@ -48,23 +48,23 @@ type roundTest struct {
int uint64;
}
-var roundtests = []roundTest (
- roundTest( 0, 4, "0", "0", "0", 0 ),
- roundTest( 12344999, 4, "12340000", "12340000", "12350000", 12340000 ),
- roundTest( 12345000, 4, "12340000", "12340000", "12350000", 12340000 ),
- roundTest( 12345001, 4, "12340000", "12350000", "12350000", 12350000 ),
- roundTest( 23454999, 4, "23450000", "23450000", "23460000", 23450000 ),
- roundTest( 23455000, 4, "23450000", "23460000", "23460000", 23460000 ),
- roundTest( 23455001, 4, "23450000", "23460000", "23460000", 23460000 ),
+var roundtests = []roundTest {
+ roundTest{ 0, 4, "0", "0", "0", 0 },
+ roundTest{ 12344999, 4, "12340000", "12340000", "12350000", 12340000 },
+ roundTest{ 12345000, 4, "12340000", "12340000", "12350000", 12340000 },
+ roundTest{ 12345001, 4, "12340000", "12350000", "12350000", 12350000 },
+ roundTest{ 23454999, 4, "23450000", "23450000", "23460000", 23450000 },
+ roundTest{ 23455000, 4, "23450000", "23460000", "23460000", 23460000 },
+ roundTest{ 23455001, 4, "23450000", "23460000", "23460000", 23460000 },
- roundTest( 99994999, 4, "99990000", "99990000", "100000000", 99990000 ),
- roundTest( 99995000, 4, "99990000", "100000000", "100000000", 100000000 ),
- roundTest( 99999999, 4, "99990000", "100000000", "100000000", 100000000 ),
+ roundTest{ 99994999, 4, "99990000", "99990000", "100000000", 99990000 },
+ roundTest{ 99995000, 4, "99990000", "100000000", "100000000", 100000000 },
+ roundTest{ 99999999, 4, "99990000", "100000000", "100000000", 100000000 },
- roundTest( 12994999, 4, "12990000", "12990000", "13000000", 12990000 ),
- roundTest( 12995000, 4, "12990000", "13000000", "13000000", 13000000 ),
- roundTest( 12999999, 4, "12990000", "13000000", "13000000", 13000000 ),
-)
+ roundTest{ 12994999, 4, "12990000", "12990000", "13000000", 12990000 },
+ roundTest{ 12995000, 4, "12990000", "13000000", "13000000", 13000000 },
+ roundTest{ 12999999, 4, "12990000", "13000000", "13000000", 13000000 },
+}
func TestDecimalRound(t *testing.T) {
for i := 0; i < len(roundtests); i++ {
@@ -93,18 +93,18 @@ type roundIntTest struct {
int uint64;
}
-var roundinttests = []roundIntTest (
- roundIntTest( 0, 100, 0 ),
- roundIntTest( 512, -8, 2 ),
- roundIntTest( 513, -8, 2 ),
- roundIntTest( 640, -8, 2 ),
- roundIntTest( 641, -8, 3 ),
- roundIntTest( 384, -8, 2 ),
- roundIntTest( 385, -8, 2 ),
- roundIntTest( 383, -8, 1 ),
- roundIntTest( 1, 100, 1<<64-1 ),
- roundIntTest( 1000, 0, 1000 ),
-)
+var roundinttests = []roundIntTest {
+ roundIntTest{ 0, 100, 0 },
+ roundIntTest{ 512, -8, 2 },
+ roundIntTest{ 513, -8, 2 },
+ roundIntTest{ 640, -8, 2 },
+ roundIntTest{ 641, -8, 3 },
+ roundIntTest{ 384, -8, 2 },
+ roundIntTest{ 385, -8, 2 },
+ roundIntTest{ 383, -8, 1 },
+ roundIntTest{ 1, 100, 1<<64-1 },
+ roundIntTest{ 1000, 0, 1000 },
+}
func TestDecimalRoundedInteger(t *testing.T) {
for i := 0; i < len(roundinttests); i++ {
diff --git a/src/lib/strconv/ftoa.go b/src/lib/strconv/ftoa.go
index 75bb3a21fa..52835c803e 100644
--- a/src/lib/strconv/ftoa.go
+++ b/src/lib/strconv/ftoa.go
@@ -21,8 +21,8 @@ type floatInfo struct {
expbits uint;
bias int;
}
-var float32info = floatInfo( 23, 8, -127 )
-var float64info = floatInfo( 52, 11, -1023 )
+var float32info = floatInfo{ 23, 8, -127 }
+var float64info = floatInfo{ 52, 11, -1023 }
func fmtB(neg bool, mant uint64, exp int, flt *floatInfo) string
func fmtE(neg bool, d *decimal, prec int) string
diff --git a/src/lib/strconv/ftoa_test.go b/src/lib/strconv/ftoa_test.go
index 09fdeaca57..0f0baa5145 100644
--- a/src/lib/strconv/ftoa_test.go
+++ b/src/lib/strconv/ftoa_test.go
@@ -24,80 +24,80 @@ const (
above1e23 = 100000000000000008388608;
)
-var ftoatests = []ftoaTest (
- ftoaTest( 1, 'e', 5, "1.00000e+00" ),
- ftoaTest( 1, 'f', 5, "1.00000" ),
- ftoaTest( 1, 'g', 5, "1" ),
- ftoaTest( 1, 'g', -1, "1" ),
- ftoaTest( 20, 'g', -1, "20" ),
- ftoaTest( 1234567.8, 'g', -1, "1.2345678e+06" ),
- ftoaTest( 200000, 'g', -1, "200000" ),
- ftoaTest( 2000000, 'g', -1, "2e+06" ),
+var ftoatests = []ftoaTest {
+ ftoaTest{ 1, 'e', 5, "1.00000e+00" },
+ ftoaTest{ 1, 'f', 5, "1.00000" },
+ ftoaTest{ 1, 'g', 5, "1" },
+ ftoaTest{ 1, 'g', -1, "1" },
+ ftoaTest{ 20, 'g', -1, "20" },
+ ftoaTest{ 1234567.8, 'g', -1, "1.2345678e+06" },
+ ftoaTest{ 200000, 'g', -1, "200000" },
+ ftoaTest{ 2000000, 'g', -1, "2e+06" },
- ftoaTest( 0, 'e', 5, "0.00000e+00" ),
- ftoaTest( 0, 'f', 5, "0.00000" ),
- ftoaTest( 0, 'g', 5, "0" ),
- ftoaTest( 0, 'g', -1, "0" ),
+ ftoaTest{ 0, 'e', 5, "0.00000e+00" },
+ ftoaTest{ 0, 'f', 5, "0.00000" },
+ ftoaTest{ 0, 'g', 5, "0" },
+ ftoaTest{ 0, 'g', -1, "0" },
- ftoaTest( -1, 'e', 5, "-1.00000e+00" ),
- ftoaTest( -1, 'f', 5, "-1.00000" ),
- ftoaTest( -1, 'g', 5, "-1" ),
- ftoaTest( -1, 'g', -1, "-1" ),
+ ftoaTest{ -1, 'e', 5, "-1.00000e+00" },
+ ftoaTest{ -1, 'f', 5, "-1.00000" },
+ ftoaTest{ -1, 'g', 5, "-1" },
+ ftoaTest{ -1, 'g', -1, "-1" },
- ftoaTest( 12, 'e', 5, "1.20000e+01" ),
- ftoaTest( 12, 'f', 5, "12.00000" ),
- ftoaTest( 12, 'g', 5, "12" ),
- ftoaTest( 12, 'g', -1, "12" ),
+ ftoaTest{ 12, 'e', 5, "1.20000e+01" },
+ ftoaTest{ 12, 'f', 5, "12.00000" },
+ ftoaTest{ 12, 'g', 5, "12" },
+ ftoaTest{ 12, 'g', -1, "12" },
- ftoaTest( 123456700, 'e', 5, "1.23457e+08" ),
- ftoaTest( 123456700, 'f', 5, "123456700.00000" ),
- ftoaTest( 123456700, 'g', 5, "1.2346e+08" ),
- ftoaTest( 123456700, 'g', -1, "1.234567e+08" ),
+ ftoaTest{ 123456700, 'e', 5, "1.23457e+08" },
+ ftoaTest{ 123456700, 'f', 5, "123456700.00000" },
+ ftoaTest{ 123456700, 'g', 5, "1.2346e+08" },
+ ftoaTest{ 123456700, 'g', -1, "1.234567e+08" },
- ftoaTest( 1.2345e6, 'e', 5, "1.23450e+06" ),
- ftoaTest( 1.2345e6, 'f', 5, "1234500.00000" ),
- ftoaTest( 1.2345e6, 'g', 5, "1.2345e+06" ),
+ ftoaTest{ 1.2345e6, 'e', 5, "1.23450e+06" },
+ ftoaTest{ 1.2345e6, 'f', 5, "1234500.00000" },
+ ftoaTest{ 1.2345e6, 'g', 5, "1.2345e+06" },
- ftoaTest( 1e23, 'e', 17, "9.99999999999999916e+22" ),
- ftoaTest( 1e23, 'f', 17, "99999999999999991611392.00000000000000000" ),
- ftoaTest( 1e23, 'g', 17, "9.9999999999999992e+22" ),
+ ftoaTest{ 1e23, 'e', 17, "9.99999999999999916e+22" },
+ ftoaTest{ 1e23, 'f', 17, "99999999999999991611392.00000000000000000" },
+ ftoaTest{ 1e23, 'g', 17, "9.9999999999999992e+22" },
- ftoaTest( 1e23, 'e', -1, "1e+23" ),
- ftoaTest( 1e23, 'f', -1, "100000000000000000000000" ),
- ftoaTest( 1e23, 'g', -1, "1e+23" ),
+ ftoaTest{ 1e23, 'e', -1, "1e+23" },
+ ftoaTest{ 1e23, 'f', -1, "100000000000000000000000" },
+ ftoaTest{ 1e23, 'g', -1, "1e+23" },
- ftoaTest( below1e23, 'e', 17, "9.99999999999999748e+22" ),
- ftoaTest( below1e23, 'f', 17, "99999999999999974834176.00000000000000000" ),
- ftoaTest( below1e23, 'g', 17, "9.9999999999999975e+22" ),
+ ftoaTest{ below1e23, 'e', 17, "9.99999999999999748e+22" },
+ ftoaTest{ below1e23, 'f', 17, "99999999999999974834176.00000000000000000" },
+ ftoaTest{ below1e23, 'g', 17, "9.9999999999999975e+22" },
- ftoaTest( below1e23, 'e', -1, "9.999999999999997e+22" ),
- ftoaTest( below1e23, 'f', -1, "99999999999999970000000" ),
- ftoaTest( below1e23, 'g', -1, "9.999999999999997e+22" ),
+ ftoaTest{ below1e23, 'e', -1, "9.999999999999997e+22" },
+ ftoaTest{ below1e23, 'f', -1, "99999999999999970000000" },
+ ftoaTest{ below1e23, 'g', -1, "9.999999999999997e+22" },
- ftoaTest( above1e23, 'e', 17, "1.00000000000000008e+23" ),
- ftoaTest( above1e23, 'f', 17, "100000000000000008388608.00000000000000000" ),
- ftoaTest( above1e23, 'g', 17, "1.0000000000000001e+23" ),
+ ftoaTest{ above1e23, 'e', 17, "1.00000000000000008e+23" },
+ ftoaTest{ above1e23, 'f', 17, "100000000000000008388608.00000000000000000" },
+ ftoaTest{ above1e23, 'g', 17, "1.0000000000000001e+23" },
- ftoaTest( above1e23, 'e', -1, "1.0000000000000001e+23" ),
- ftoaTest( above1e23, 'f', -1, "100000000000000010000000" ),
- ftoaTest( above1e23, 'g', -1, "1.0000000000000001e+23" ),
+ ftoaTest{ above1e23, 'e', -1, "1.0000000000000001e+23" },
+ ftoaTest{ above1e23, 'f', -1, "100000000000000010000000" },
+ ftoaTest{ above1e23, 'g', -1, "1.0000000000000001e+23" },
- ftoaTest( fdiv(5e-304, 1e20), 'g', -1, "5e-324" ),
- ftoaTest( fdiv(-5e-304, 1e20), 'g', -1, "-5e-324" ),
+ ftoaTest{ fdiv(5e-304, 1e20), 'g', -1, "5e-324" },
+ ftoaTest{ fdiv(-5e-304, 1e20), 'g', -1, "-5e-324" },
- ftoaTest( 32, 'g', -1, "32" ),
- ftoaTest( 32, 'g', 0, "3e+01" ),
+ ftoaTest{ 32, 'g', -1, "32" },
+ ftoaTest{ 32, 'g', 0, "3e+01" },
- ftoaTest( 100, 'x', -1, "%x" ),
+ ftoaTest{ 100, 'x', -1, "%x" },
- ftoaTest( math.NaN(), 'g', -1, "NaN" ),
- ftoaTest( -math.NaN(), 'g', -1, "NaN" ),
- ftoaTest( math.Inf(0), 'g', -1, "+Inf" ),
- ftoaTest( math.Inf(-1), 'g', -1, "-Inf" ),
- ftoaTest( -math.Inf(0), 'g', -1, "-Inf" ),
+ ftoaTest{ math.NaN(), 'g', -1, "NaN" },
+ ftoaTest{ -math.NaN(), 'g', -1, "NaN" },
+ ftoaTest{ math.Inf(0), 'g', -1, "+Inf" },
+ ftoaTest{ math.Inf(-1), 'g', -1, "-Inf" },
+ ftoaTest{ -math.Inf(0), 'g', -1, "-Inf" },
- ftoaTest( -1, 'b', -1, "-4503599627370496p-52" ),
-)
+ ftoaTest{ -1, 'b', -1, "-4503599627370496p-52" },
+}
func TestFtoa(t *testing.T) {
if strconv.FloatSize != 32 {
diff --git a/src/lib/strconv/itoa_test.go b/src/lib/strconv/itoa_test.go
index f67f08739f..34caf9a325 100644
--- a/src/lib/strconv/itoa_test.go
+++ b/src/lib/strconv/itoa_test.go
@@ -17,47 +17,47 @@ type itob64Test struct {
out string;
}
-var itob64tests = []itob64Test (
- itob64Test( 0, 10, "0" ),
- itob64Test( 1, 10, "1" ),
- itob64Test( -1, 10, "-1" ),
- itob64Test( 12345678, 10, "12345678" ),
- itob64Test( -987654321, 10, "-987654321" ),
- itob64Test( 1<<31-1, 10, "2147483647" ),
- itob64Test( -1<<31+1, 10, "-2147483647" ),
- itob64Test( 1<<31, 10, "2147483648" ),
- itob64Test( -1<<31, 10, "-2147483648" ),
- itob64Test( 1<<31+1, 10, "2147483649" ),
- itob64Test( -1<<31-1, 10, "-2147483649" ),
- itob64Test( 1<<32-1, 10, "4294967295" ),
- itob64Test( -1<<32+1, 10, "-4294967295" ),
- itob64Test( 1<<32, 10, "4294967296" ),
- itob64Test( -1<<32, 10, "-4294967296" ),
- itob64Test( 1<<32+1, 10, "4294967297" ),
- itob64Test( -1<<32-1, 10, "-4294967297" ),
- itob64Test( 1<<50, 10, "1125899906842624" ),
- itob64Test( 1<<63-1, 10, "9223372036854775807" ),
- itob64Test( -1<<63+1, 10, "-9223372036854775807" ),
- itob64Test( -1<<63, 10, "-9223372036854775808" ),
+var itob64tests = []itob64Test {
+ itob64Test{ 0, 10, "0" },
+ itob64Test{ 1, 10, "1" },
+ itob64Test{ -1, 10, "-1" },
+ itob64Test{ 12345678, 10, "12345678" },
+ itob64Test{ -987654321, 10, "-987654321" },
+ itob64Test{ 1<<31-1, 10, "2147483647" },
+ itob64Test{ -1<<31+1, 10, "-2147483647" },
+ itob64Test{ 1<<31, 10, "2147483648" },
+ itob64Test{ -1<<31, 10, "-2147483648" },
+ itob64Test{ 1<<31+1, 10, "2147483649" },
+ itob64Test{ -1<<31-1, 10, "-2147483649" },
+ itob64Test{ 1<<32-1, 10, "4294967295" },
+ itob64Test{ -1<<32+1, 10, "-4294967295" },
+ itob64Test{ 1<<32, 10, "4294967296" },
+ itob64Test{ -1<<32, 10, "-4294967296" },
+ itob64Test{ 1<<32+1, 10, "4294967297" },
+ itob64Test{ -1<<32-1, 10, "-4294967297" },
+ itob64Test{ 1<<50, 10, "1125899906842624" },
+ itob64Test{ 1<<63-1, 10, "9223372036854775807" },
+ itob64Test{ -1<<63+1, 10, "-9223372036854775807" },
+ itob64Test{ -1<<63, 10, "-9223372036854775808" },
- itob64Test( 0, 2, "0" ),
- itob64Test( 10, 2, "1010" ),
- itob64Test( -1, 2, "-1" ),
- itob64Test( 1<<15, 2, "1000000000000000" ),
+ itob64Test{ 0, 2, "0" },
+ itob64Test{ 10, 2, "1010" },
+ itob64Test{ -1, 2, "-1" },
+ itob64Test{ 1<<15, 2, "1000000000000000" },
- itob64Test( -8, 8, "-10" ),
- itob64Test( 057635436545, 8, "57635436545" ),
- itob64Test( 1<<24, 8, "100000000" ),
+ itob64Test{ -8, 8, "-10" },
+ itob64Test{ 057635436545, 8, "57635436545" },
+ itob64Test{ 1<<24, 8, "100000000" },
- itob64Test( 16, 16, "10" ),
- itob64Test( -0x123456789abcdef, 16, "-123456789abcdef" ),
- itob64Test( 1<<63-1, 16, "7fffffffffffffff" ),
+ itob64Test{ 16, 16, "10" },
+ itob64Test{ -0x123456789abcdef, 16, "-123456789abcdef" },
+ itob64Test{ 1<<63-1, 16, "7fffffffffffffff" },
- itob64Test( 16, 17, "g" ),
- itob64Test( 25, 25, "10" ),
- itob64Test( (((((17*35+24)*35+21)*35+34)*35+12)*35+24)*35+32, 35, "holycow" ),
- itob64Test( (((((17*36+24)*36+21)*36+34)*36+12)*36+24)*36+32, 36, "holycow" ),
-)
+ itob64Test{ 16, 17, "g" },
+ itob64Test{ 25, 25, "10" },
+ itob64Test{ (((((17*35+24)*35+21)*35+34)*35+12)*35+24)*35+32, 35, "holycow" },
+ itob64Test{ (((((17*36+24)*36+21)*36+34)*36+12)*36+24)*36+32, 36, "holycow" },
+}
func TestItoa(t *testing.T) {
for i := 0; i < len(itob64tests); i++ {
@@ -102,11 +102,10 @@ type uitoa64Test struct {
}
// 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" },
+}
diff --git a/src/lib/strconv/quote_test.go b/src/lib/strconv/quote_test.go
index 06d72f7537..8421fcde49 100644
--- a/src/lib/strconv/quote_test.go
+++ b/src/lib/strconv/quote_test.go
@@ -14,14 +14,14 @@ type quoteTest struct {
out string;
}
-var quotetests = []quoteTest (
- quoteTest( "\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"` ),
- quoteTest( "\\", `"\\"` ),
- quoteTest( "abc\xffdef", `"abc\xffdef"` ),
- quoteTest( "\u263a", `"\u263a"` ),
- quoteTest( "\U0010ffff", `"\U0010ffff"` ),
- quoteTest( "\x04", `"\x04"` ),
-)
+var quotetests = []quoteTest {
+ quoteTest{ "\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"` },
+ quoteTest{ "\\", `"\\"` },
+ quoteTest{ "abc\xffdef", `"abc\xffdef"` },
+ quoteTest{ "\u263a", `"\u263a"` },
+ quoteTest{ "\U0010ffff", `"\U0010ffff"` },
+ quoteTest{ "\x04", `"\x04"` },
+}
func TestQuote(t *testing.T) {
for i := 0; i < len(quotetests); i++ {
@@ -37,46 +37,46 @@ type canBackquoteTest struct {
out bool;
}
-var canbackquotetests = []canBackquoteTest (
- canBackquoteTest( "`", false ),
- canBackquoteTest( string(0), false ),
- canBackquoteTest( string(1), false ),
- canBackquoteTest( string(2), false ),
- canBackquoteTest( string(3), false ),
- canBackquoteTest( string(4), false ),
- canBackquoteTest( string(5), false ),
- canBackquoteTest( string(6), false ),
- canBackquoteTest( string(7), false ),
- canBackquoteTest( string(8), false ),
- canBackquoteTest( string(9), false ),
- canBackquoteTest( string(10), false ),
- canBackquoteTest( string(11), false ),
- canBackquoteTest( string(12), false ),
- canBackquoteTest( string(13), false ),
- canBackquoteTest( string(14), false ),
- canBackquoteTest( string(15), false ),
- canBackquoteTest( string(16), false ),
- canBackquoteTest( string(17), false ),
- canBackquoteTest( string(18), false ),
- canBackquoteTest( string(19), false ),
- canBackquoteTest( string(20), false ),
- canBackquoteTest( string(21), false ),
- canBackquoteTest( string(22), false ),
- canBackquoteTest( string(23), false ),
- canBackquoteTest( string(24), false ),
- canBackquoteTest( string(25), false ),
- canBackquoteTest( string(26), false ),
- canBackquoteTest( string(27), false ),
- canBackquoteTest( string(28), false ),
- canBackquoteTest( string(29), false ),
- canBackquoteTest( string(30), false ),
- canBackquoteTest( string(31), false ),
- canBackquoteTest( `' !"#$%&'()*+,-./:;<=>?@[\]^_{|}~`, true ),
- canBackquoteTest( `0123456789`, true ),
- canBackquoteTest( `ABCDEFGHIJKLMNOPQRSTUVWXYZ`, true ),
- canBackquoteTest( `abcdefghijklmnopqrstuvwxyz`, true ),
- canBackquoteTest( `☺`, true ),
-)
+var canbackquotetests = []canBackquoteTest {
+ canBackquoteTest{ "`", false },
+ canBackquoteTest{ string(0), false },
+ canBackquoteTest{ string(1), false },
+ canBackquoteTest{ string(2), false },
+ canBackquoteTest{ string(3), false },
+ canBackquoteTest{ string(4), false },
+ canBackquoteTest{ string(5), false },
+ canBackquoteTest{ string(6), false },
+ canBackquoteTest{ string(7), false },
+ canBackquoteTest{ string(8), false },
+ canBackquoteTest{ string(9), false },
+ canBackquoteTest{ string(10), false },
+ canBackquoteTest{ string(11), false },
+ canBackquoteTest{ string(12), false },
+ canBackquoteTest{ string(13), false },
+ canBackquoteTest{ string(14), false },
+ canBackquoteTest{ string(15), false },
+ canBackquoteTest{ string(16), false },
+ canBackquoteTest{ string(17), false },
+ canBackquoteTest{ string(18), false },
+ canBackquoteTest{ string(19), false },
+ canBackquoteTest{ string(20), false },
+ canBackquoteTest{ string(21), false },
+ canBackquoteTest{ string(22), false },
+ canBackquoteTest{ string(23), false },
+ canBackquoteTest{ string(24), false },
+ canBackquoteTest{ string(25), false },
+ canBackquoteTest{ string(26), false },
+ canBackquoteTest{ string(27), false },
+ canBackquoteTest{ string(28), false },
+ canBackquoteTest{ string(29), false },
+ canBackquoteTest{ string(30), false },
+ canBackquoteTest{ string(31), false },
+ canBackquoteTest{ `' !"#$%&'()*+,-./:;<=>?@[\]^_{|}~`, true },
+ canBackquoteTest{ `0123456789`, true },
+ canBackquoteTest{ `ABCDEFGHIJKLMNOPQRSTUVWXYZ`, true },
+ canBackquoteTest{ `abcdefghijklmnopqrstuvwxyz`, true },
+ canBackquoteTest{ `☺`, true },
+}
func TestCanBackquote(t *testing.T) {
for i := 0; i < len(canbackquotetests); i++ {