-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Clock - extreme values test cases? #150
Comments
Great idea! Would you like to submit a PR or would you prefer I do it (I'm fine either way)? Adding extra tests requires adding a |
Thanks for your kind words! And I really appreciate the instructions you gave, I think it's a very good approach towards new contributors. Unfortunately I've been feeling somewhat overloaded recently, and I'd rather not add this to my TODO list. So if you are fine with creating a PR, that would be great. |
Hi @kukimik , |
@ageron Thanks, I'll take a look at it in a few days. |
Looks like I'm late. Sorry. Anyway, thanks for handling this! |
No worries at all, thanks for the suggestion! |
What do you think about adding tests that check the program works correctly for extreme values of
hours
andminutes
, i.e.: -9_223_372_036_854_775_808 and 9_223_372_036_854_775_807?On the one hand, it is simple and elegant to define
subtract
in terms ofadd
by setting:and in practice this is often the "right" thing to do. This approach teaches code reuse.
On the other hand,
subtract
defined as above will fail if eitherhours
orminutes
have value-9_223_372_036_854_775_808
. If this case is included in the tests, it can teach being careful about overflows.Also, for such inputs some reasonable programs will fail at converting hours to minutes and other similar operations.
The text was updated successfully, but these errors were encountered: