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

Function TestNewFromInt

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

Source from the content-addressed store, hash-verified

475}
476
477func 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
503func TestNewFromInt32(t *testing.T) {
504 tests := map[int32]string{

Callers

nothing calls this directly

Calls 2

NewFromIntFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…