Commit 780e16e6 authored by zhanghuiren's avatar zhanghuiren

more testcase

parent 0fe02aeb
......@@ -32,6 +32,8 @@ func TestInteger(t *testing.T) {
{`ten`, `10`, `10`, false},
{`-ten`, `-10`, `-10`, false},
{`30digits`, `123456789012345678901234567890`, `123456789012345678901234567890`, false},
{`-37digits`, `-3987683987354747618711421180841033728`, `-3987683987354747618711421180841033728`, false},
{`1x2x3x4`, `79228162551157825753847955460`, `79228162551157825753847955460`, false},
{`invalid-x010`, `x010`, ``, true},
{`invalid-a010`, `a010`, ``, true},
{`invalid-10x`, `10x`, ``, true},
......@@ -70,7 +72,15 @@ func TestInteger_FromSignAndMag(t *testing.T) {
{`4294967295`, `4294967295`, args{1, []int{4294967295}}},
{`4294967296`, `4294967296`, args{1, []int{1, 0}}},
{`4294967298`, `4294967298`, args{1, []int{1, 2}}},
// these case is build by python
{`1x2x3`, `18446744082299486211`, args{1, []int{1, 2, 3}}},
{`1x2x3x4`, `79228162551157825753847955460`, args{1, []int{1, 2, 3, 4}}},
{`(((1<<32)-1)<<32)|(1<<10)`, `18446744069414585344`, args{1, []int{1<<32 - 1, 1 << 10}}},
{`(((1<<24)-1)<<32)|(1<<10)`, `72057589742961664`, args{1, []int{1<<24 - 1, 1 << 10}}},
{`(((1<<16)-1)<<32)|(1<<10)`, `281470681744384`, args{1, []int{1<<16 - 1, 1 << 10}}},
{`(((1<<8)-1)<<32)|(1<<10)`, `1095216661504`, args{1, []int{1<<8 - 1, 1 << 10}}},
{`maxuint64=(1<<64)-1`, `18446744073709551615`, args{1, []int{1<<32 - 1, 1<<32 - 1}}},
{`(1<<64)`, `18446744073709551616`, args{1, []int{1, 0, 0}}},
{`-1`, `-1`, args{-1, []int{1}}},
{`-4294967296`, `-4294967296`, args{-1, []int{1, 0}}},
{`-4294967298`, `-4294967298`, args{-1, []int{1, 2}}},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment