-
-
Notifications
You must be signed in to change notification settings - Fork 522
clock: canonical test data has been improved #282
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
This has the non-comparitive tests implemented from the changes implemented in the canonical changes introduced by @kytrinyx references #282 references exercism/problem-specifications#166
fixes #282 references exercism/problem-specifications#166
fixes #282 references exercism/problem-specifications#166
I am not sure what you mean here exactly. Perhaps you could clarify or add some example code? From what I understand, this seems to be two issues. One the problem of having mutation where it does not belong and another, where people mistake identity for equality (surely we want equality here?). I think part of the problem lies in the fact that the tests for the Example because code == good: # From
def test_wrap_around_at_midnight
skip
clock = Clock.at(23, 30) + 60
assert_equal '00:30', clock.to_s
end
# To
def test_wrap_around_at_midnight
skip
clock = Clock.at(23, 30) + 60
assert_equal Clock.at(00, 30), clock
end I also still feel strongly that the addition operator should not be used like this, because it goes against ruby style to have self-mutating operators and because addition here is non-commutative. I'd much rather see a named method used or a check against mutation. It's worth pointing out that ruby's core classes all implement addition in various ways that are also non-commutative, but are very much non-mutating as well. |
Code examples are likely going to be on the exercism.io site, in Go Track (reference: exercism/problem-specifications#166) Changed state comment, history of discussion, ref: below...
|
@remcopeereboom this was just the one problem about equality--not that they checked identity instead of equality but that equality failed. I totally misrepresented the problem--they weren't mutating the clock, they were just computing the correct display value based on the desired test output... this meant that they could have two clocks that were not equal, but displayed the same value. Here's an example:
|
Got it, thanks! Seems to me handling equality in that way is a valid if perhaps inelegant thing to do. |
No, the clocks aren't equal they only look equal. They fail with |
Yes I understood that, I should have been more clear perhaps. I mean that implementing the conversion to limit minutes to 0-60 and hours to 0-24 in the string method and then overriding equality to compare the strings should be okay (in the ruby version at least, where you can't just read the hours and minutes). |
Might it make sense to add hour and minute attributes to the clock in the tests? |
@remcopeereboom Aaah, yeah, that could work. |
@kytrinyx The clocks are ending up == and === in the tests. I was surprised about the ===. Of course their object id's are different. |
fixes #282 references exercism/problem-specifications#166
Generated from x-common clock data Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
I have the generator data being used for the tests, now, see the referenced commit above. Did not address the comments here, necessarily though, wanted to get the generator in place. |
Generated from x-common clock data Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
Generated from x-common clock data Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
Generated from x-common clock data Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
Generated from x-common clock data Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
Now generates tests from data in x-common. The template file is skinny, the generator a little fatter. fixes #282 references exercism/problem-specifications#166
…suite Common Test Suite for Robot Simulator
The JSON file containing canonical inputs/outputs for the Clock exercise has gotten new data.
There are two situations that the original data didn't account for:
If this track has a generator for the Clock exercise, go ahead and regenerate it now. If it doesn't, then please verify the implementation of the test suite against the new data. If any cases are missing, they should be added.
See exercism/problem-specifications#166
The text was updated successfully, but these errors were encountered: