| 2341 | } |
| 2342 | |
| 2343 | func TestBigIntText(t *testing.T) { |
| 2344 | z := new(BigInt) |
| 2345 | for _, test := range stringTests { |
| 2346 | if !test.ok { |
| 2347 | continue |
| 2348 | } |
| 2349 | |
| 2350 | _, ok := z.SetString(test.in, test.base) |
| 2351 | if !ok { |
| 2352 | t.Errorf("%v: failed to parse", test) |
| 2353 | continue |
| 2354 | } |
| 2355 | |
| 2356 | base := test.base |
| 2357 | if base == 0 { |
| 2358 | base = 10 |
| 2359 | } |
| 2360 | |
| 2361 | if got := z.Text(base); got != test.out { |
| 2362 | t.Errorf("%v: got %s; want %s", test, got, test.out) |
| 2363 | } |
| 2364 | } |
| 2365 | } |
| 2366 | |
| 2367 | func TestBigIntAppendText(t *testing.T) { |
| 2368 | z := new(BigInt) |