-
-
Notifications
You must be signed in to change notification settings - Fork 555
Why have null as input in pascals-triangle exercise #925
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
Comments
It doesn't make any sense either to return -1. |
I'm aware of it, but I think that shouldn't be explicit. Some exercises are already using |
I would refer to #902 here, though I'm not convinced a conclusion arose. Nevertheless, I do not think testing In most languages that have static type checking, even if they have nullable references, integers are not reference types, so if the function under test is defined to take an integer, null is not a possible input. For languages without static type checking, So, removing Separately, indeed, that |
I've created a PR to fix this issue. I've not updated the expected return value, as that should be a different PR I think. |
In the canonical data for the pascals-triangle exercise, the last test case checks for null/missing input: https://github.com/exercism/problem-specifications/blob/master/exercises/pascals-triangle/canonical-data.json#L50 However, to me this does not make sense at all, as you have to specify a number to calculate pascal's triangle. Having no input does not make any sense, unless you want to calculate a default, but the test case for the null input states that passing null means a failure should occur.
My suggestion is to remove this null error case, as it doesn't really add anything (there alreadt is a negative number case that will enforce error handling).
The text was updated successfully, but these errors were encountered: