triangle: Allow triangles where a+b == c#232
Merged
kytrinyx merged 2 commits intoexercism:masterfrom Jan 30, 2016
petertseng:triangle-equal
Merged
triangle: Allow triangles where a+b == c#232kytrinyx merged 2 commits intoexercism:masterfrom petertseng:triangle-equal
kytrinyx merged 2 commits intoexercism:masterfrom
petertseng:triangle-equal
Conversation
Member
Author
|
Ah hold on. Should probably bump test version. There is none for this currently, so that means just make it 1. |
Member
Author
There was a problem hiding this comment.
someone might be confused about why you only need to check c and not a, b. comment?
These are degenerate triangles since they're really just lines, but they're still good enough under the triangle inequality (which explicitly allows a+b == c) so let's go ahead and test for them. Test for isosceles and scalene added. Equilateral is impossible. Unfortunately, now we are at risk for failing a test case of (3, Inf, Inf), since 3 + Inf == Inf, and Inf < Inf is false whereas previously the test was Inf <= Inf which is true. So we might falsely declare this triangle as isosceles when it should be NaT. So we need to add another test to make sure that our largest side isn't +Inf. Closes #231
Member
Author
|
Test version is added so this is ready for review. |
Merged
The previous change (allow a+b == c) changes test behavior, so now's as good a time as any to add a test version. The previous version can be considered to be 0 since it isn't present, so 1 is OK to use here.
Member
Author
There was a problem hiding this comment.
Notice that most other elements of this file (KindFromSides, Kind, Equ, etc...) have some sort of explanatory comment. I chose not to include one for TestVersion since students should have gotten the drill already from previous exercises. Let me know if you disagree.
Member
|
Thank you! |
kytrinyx
added a commit
that referenced
this pull request
Jan 30, 2016
triangle: Allow triangles where a+b == c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are degenerate triangles since they're really just lines, but
they're still good enough under the triangle inequality (which
explicitly allows a+b == c) so let's go ahead and test for them.
Test for isosceles and scalene added. Equilateral is impossible.
Closes #231