summaryrefslogtreecommitdiff
path: root/src/lib/strconv/atoi_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/strconv/atoi_test.go')
-rw-r--r--src/lib/strconv/atoi_test.go130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/lib/strconv/atoi_test.go b/src/lib/strconv/atoi_test.go
index 5ffda142e..d57846d23 100644
--- a/src/lib/strconv/atoi_test.go
+++ b/src/lib/strconv/atoi_test.go
@@ -16,18 +16,18 @@ 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", 0, os.EINVAL },
- 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 },
-}
+var atoui64tests = []atoui64Test (
+ atoui64Test( "", 0, os.EINVAL ),
+ atoui64Test( "0", 0, nil ),
+ atoui64Test( "1", 1, nil ),
+ atoui64Test( "12345", 12345, nil ),
+ atoui64Test( "012345", 0, os.EINVAL ),
+ 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 ),
+)
type atoi64Test struct {
in string;
@@ -35,27 +35,27 @@ 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", 0, os.EINVAL },
- atoi64Test{ "-012345", 0, os.EINVAL },
- 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", 0, os.EINVAL ),
+ atoi64Test( "-012345", 0, os.EINVAL ),
+ 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;
@@ -63,17 +63,17 @@ 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", 0, os.EINVAL },
- 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", 0, os.EINVAL ),
+ 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;
@@ -81,27 +81,27 @@ 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", 0, os.EINVAL },
- atoi32Test{ "-012345", 0, os.EINVAL },
- 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", 0, os.EINVAL ),
+ atoi32Test( "-012345", 0, os.EINVAL ),
+ 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++ {