You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your test for Copy() method does not check inequality of pointers
funcTestCopy(t*testing.T) {
origin:=New(1, 0)
cpy:=origin.Copy()
ifcpy.Cmp(origin) !=0 {
t.Error("expecting copy and origin to be equals, but they are not")
}
//change valuecpy=cpy.Add(New(1, 0))
ifcpy.Cmp(origin) ==0 {
t.Error("expecting copy and origin to have different values, but they are equal")
}
}
Expect:
values have different pointers
$ go version
go version go1.20.5 linux/amd64
The text was updated successfully, but these errors were encountered:
Method Copy() says
// Copy returns a copy of decimal with the same value and exponent, but a different pointer to value.
Got:
Simple test show that pointers are actually equal
Your test for Copy() method does not check inequality of pointers
Expect:
values have different pointers
The text was updated successfully, but these errors were encountered: