MCPcopy
hub / github.com/shopspring/decimal / TestNewFromInt32

Function TestNewFromInt32

decimal_test.go:503–527  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

501}
502
503func 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
529func TestNewFromUint64(t *testing.T) {
530 tests := map[uint64]string{

Callers

nothing calls this directly

Calls 2

NewFromInt32Function · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…