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

Function TestDecimal_Neg

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

Source from the content-addressed store, hash-verified

1737}
1738
1739func TestDecimal_Neg(t *testing.T) {
1740 inputs := map[string]string{
1741 "0": "0",
1742 "10": "-10",
1743 "5.56": "-5.56",
1744 "-10": "10",
1745 "-5.56": "5.56",
1746 }
1747
1748 for inp, res := range inputs {
1749 a, err := NewFromString(inp)
1750 if err != nil {
1751 t.FailNow()
1752 }
1753 b := a.Neg()
1754 if b.String() != res {
1755 t.Errorf("expected %s, got %s", res, b.String())
1756 }
1757 }
1758}
1759
1760func TestDecimal_NegFromEmpty(t *testing.T) {
1761 a := Decimal{}

Callers

nothing calls this directly

Calls 3

NewFromStringFunction · 0.85
NegMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…