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

Function TestCopy

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

Source from the content-addressed store, hash-verified

623}
624
625func TestCopy(t *testing.T) {
626 origin := New(1, 0)
627 cpy := origin.Copy()
628
629 if origin.value == cpy.value {
630 t.Error("expecting copy and origin to have different value pointers")
631 }
632
633 if cpy.Cmp(origin) != 0 {
634 t.Error("expecting copy and origin to be equals, but they are not")
635 }
636
637 //change value
638 cpy = cpy.Add(New(1, 0))
639
640 if cpy.Cmp(origin) == 0 {
641 t.Error("expecting copy and origin to have different values, but they are equal")
642 }
643}
644
645func TestJSON(t *testing.T) {
646 for _, x := range testTable {

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
CopyMethod · 0.80
CmpMethod · 0.80
AddMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…