(t *testing.T)
| 475 | } |
| 476 | |
| 477 | func TestNewFromInt(t *testing.T) { |
| 478 | tests := map[int64]string{ |
| 479 | 0: "0", |
| 480 | 1: "1", |
| 481 | 323412345: "323412345", |
| 482 | 9223372036854775807: "9223372036854775807", |
| 483 | -9223372036854775808: "-9223372036854775808", |
| 484 | } |
| 485 | |
| 486 | // add negatives |
| 487 | for p, s := range tests { |
| 488 | if p > 0 { |
| 489 | tests[-p] = "-" + s |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | for input, s := range tests { |
| 494 | d := NewFromInt(input) |
| 495 | if d.String() != s { |
| 496 | t.Errorf("expected %s, got %s (%s, %d)", |
| 497 | s, d.String(), |
| 498 | d.value.String(), d.exp) |
| 499 | } |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | func TestNewFromInt32(t *testing.T) { |
| 504 | tests := map[int32]string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…