darts: add tests to disallow absolute addition#1488
darts: add tests to disallow absolute addition#1488ErikSchierboom merged 2 commits intoexercism:masterfrom yawpitch:patch-1
Conversation
The current tests allow an erroneous-but-passing solution where the sum of the absolute values of the coordinates of the dart are compared to the radius thresholds (ie return 5 if `abs(x) + abs(y)` is greater than 1 but less than or equal to 5), rather than the calculated distance of the dart from the origin. Thanks to grwkremilek for the find.
|
Update versioning reminder. |
|
The square root of the sum of the squares of |
Version bump.
|
Since it came up today. My approval is conditional on commits being squashed. (It doesn't matter to me whether the submitter squashes them or the merger squashes them, as long as someone does) |
|
Agreed, but in this case I rather assume that’s for the merger.
…On Mar 29, 2019, 08:08 +0000, Erik Schierboom ***@***.***>, wrote:
@ErikSchierboom approved this pull request.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Squashed and merged. Thanks @yawpitch! |
|
Thinking more about this change.... I still agree it was a good change, but am now wondering would it have been better to just update
It would then not be necessary to add three more tests. |
|
I had considered doing that, but the problem is that someone could revert that change or otherwise modify those values in the future and inadvertently and silently put the tests back into a place where they have a gap in coverage for certain values of x and y. The only mechanism for flagging that the specific chosen points are significant -- as opposed to them being arbitrary points that fall within the chosen rings -- is the "description" field, which isn't exactly robust, so by making them distinct tests they both close the gap and make it harder to inadvertently re-open it, hopefully without introducing any significant overhead. |
|
Excellent point. Thanks for clarifying. |
The current tests allow an erroneous-but-passing solution where the sum of the absolute values of the coordinates of the dart are compared to the radius thresholds (ie return 5 if
abs(x) + abs(y)is greater than 1 but less than or equal to 5), rather than the calculated distance of the dart from the origin. Thanks to grwkremilek for the find.