-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
style: handle edge cases uniformly in all implementations of factorial #705
style: handle edge cases uniformly in all implementations of factorial #705
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #705 +/- ##
==========================================
+ Coverage 86.65% 86.73% +0.08%
==========================================
Files 197 197
Lines 6519 6530 +11
==========================================
+ Hits 5649 5664 +15
+ Misses 730 727 -3
+ Partials 140 139 -1 ☔ View full report in Codecov by Sentry. |
e4b49cd
to
d210374
Compare
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
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.
Instead of erroredResult, ErrNegativeArgument
just return 0, ErrNegativeArgument
since the caller is not supposed to use the result value if err != nil
.
Done in e9c894f. |
Current implementations of the factorial react differently for negative inputs. This PR fixes that. Furthermore it reduced the code duplication in the corresponding test file by expressing tests and benchmarks as parameterized.