-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more unit test coverage #1167
more unit test coverage #1167
Conversation
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetRawBlockTx(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did a git mv, but added enough new tests that git decided it wasn't similar enough to link. 🤷
fe1a3de
to
007865b
Compare
@@ -127,7 +127,7 @@ func inferPrecisionAndScale(s string) (precision, scale uint16) { | |||
|
|||
intPart := uint16(len(parts[0])) | |||
if len(parts) == 1 { | |||
return intPart, 0 | |||
return max(1, intPart), 0 // at least 1 for precision with 0 scale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In utils/conv/conv_test.go
I discovered that "0"
could not be used as a valid Decimal. I don't think that is intended, and this case catches when strings.TrimLeft(parts[0], "0")
reduced it to an empty string. @brennanjl lmk if a zero decimal is actually not supposed to be allowed. Based on code in other places, it looks like it should have been.
8919708
to
348f677
Compare
s.SetReadDeadline(time.Now().Add(time.Second)) | ||
|
||
buf := make([]byte, len(discoverPeersMsg)) | ||
nr, err := s.Read(buf) | ||
if err != nil && !errors.Is(err, io.EOF) { | ||
n.log.Warn("failed to read peer discovery request", "error", err) | ||
return | ||
} | ||
if nr == 0 { // they hung up | ||
return | ||
} | ||
if string(buf) != discoverPeersMsg { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This protocol was an early text based version. The initiator need not send some magic text message to start it off. The stream is specific to the protocol ID and ready to go.
order test client test an records minimization rm deprecated CallAction
37c9dad
to
b6c58a0
Compare
This adds more unit test coverage and fixes a number of minor bugs.