Skip to content

Conversation

@elirehema
Copy link

FIX Add functionality to compare if a decimal value is between two decimals #319

FIX Add functionality to compare if a decimal value is between two decimals shopspring#319
Copy link
Member

@mwoss mwoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review and thanks a lot for your contribution!

return cmp == -1 || cmp == 0
}

// Betwee (LTE) return true when d is between d1 and d2 inclusive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go doc should start with the method name, so I'd suggest:
IsBetween returns true when d is between (inclusive) d1 and d2, otherwise false.

if c.LessThanOrEqual(b) {
t.Errorf("%q should not be less than or equal %q", a, b)
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a separate test case for IsBetween where you verify the correctness of left and right bound inclusiveness?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants