(t *testing.T)
| 501 | } |
| 502 | |
| 503 | func TestNewFromInt32(t *testing.T) { |
| 504 | tests := map[int32]string{ |
| 505 | 0: "0", |
| 506 | 1: "1", |
| 507 | 323412345: "323412345", |
| 508 | 2147483647: "2147483647", |
| 509 | -2147483648: "-2147483648", |
| 510 | } |
| 511 | |
| 512 | // add negatives |
| 513 | for p, s := range tests { |
| 514 | if p > 0 { |
| 515 | tests[-p] = "-" + s |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | for input, s := range tests { |
| 520 | d := NewFromInt32(input) |
| 521 | if d.String() != s { |
| 522 | t.Errorf("expected %s, got %s (%s, %d)", |
| 523 | s, d.String(), |
| 524 | d.value.String(), d.exp) |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | func TestNewFromUint64(t *testing.T) { |
| 530 | tests := map[uint64]string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…