You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test with negative and 0 lengths sides of invalid triangles #1871
I've encountered solution where the student only checked if the sides are 0 and not if they are negative. In other cases only one of the functions was checking if the triangle is even valid.
I'd prefer not to add test cases for negative length sides. While technically indeed an option, our exercises don't have to be exhaustive in their tests. In other words: we don't have to guard against all invalid input. That said, if other people disagree, feel free to let me know. CC @exercism/reviewers
Reacted by Victor Goff, June, Justin "J.R." Hill, Sascha Mann and Tim Austin
@szabgab I've benefited enormously from your work! I feel like I come across your blogs & posts multiple times a year
I agree in general that most exercises don't have to be exhaustive (and especially the easy, early exercises probably should not). That said, @kotp noted here that this question about triangles and side length validation is a recurring issue.
My 2 cents is: I am lazy, and I don't like having the same discussion multiple times. My advice would be to add some tests. Implementing a <= is reasonable for a beginner exercise in my opinion. Individual tracks can decide to adopt or ignore the test cases.
Activity
BethanyG commentedon Oct 29, 2021
@szabgab -- take a look at #1836 as well -- which might change the need for additional cases.
ErikSchierboom commentedon Jan 27, 2022
I'd prefer not to add test cases for negative length sides. While technically indeed an option, our exercises don't have to be exhaustive in their tests. In other words: we don't have to guard against all invalid input. That said, if other people disagree, feel free to let me know. CC @exercism/reviewers
booniepepper commentedon Jan 31, 2022
@szabgab I've benefited enormously from your work! I feel like I come across your blogs & posts multiple times a year
I agree in general that most exercises don't have to be exhaustive (and especially the easy, early exercises probably should not). That said, @kotp noted here that this question about triangles and side length validation is a recurring issue.
My 2 cents is: I am lazy, and I don't like having the same discussion multiple times. My advice would be to add some tests. Implementing a
<=is reasonable for a beginner exercise in my opinion. Individual tracks can decide to adopt or ignore the test cases.IsaacG commentedon Jul 29, 2026
Degenerate triangles are not explicitly excluded from this exercise. See #2579
Negative and zero sides should be similarly excluded.