-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
Tests for Zipper are far from sufficient #838
Comments
Related of course: #777 Thought from my reading/understanding this behavior would still be the same even if we made massive changes to the exercise. So I think this is a separate issue. |
Instead of adding that test, each function should have a test that should assert that the object returned is a new instance, per the description. I think that will solve all the issues. We'll accept a PR on this repository, but please link back to |
You mean left and right and up? Should left/up in combo result in 3 new objects or would up return me to the original? |
From the
So we need a test for these methods to check if they're immutable. I like the idea of guiding tests as mentioned in #777 as well. |
Those are a sample list, they don't apply to the actual implementation used here. Which is another confusing point, maybe that's mentioned in #777. |
And you didn't answer me specifically:
Or perhaps you did... are you saying you'd expect 3 new objects then, ie you never return to any prior object?
I ask because in my implementation right now parent returns you to the prior object... so I want to make sure I'm 100% clear on the requirements if I'm considering updating all the tests myself. |
I meant that you could extrapolate from the README. The
SIDE NOTE: I absolutely dislike that we use
When one of the four methods is called above, a new object should be returned, per the description. So yes, if we call
It doesn't if you look at the CI example. It recreates a new |
Oh I forgot we had those sample solutions. :-) Oh, setting is suppose to make new zippers too? Yeah, even my own solution is doing this way wrong... starting to sound like a uber functional exercise. :)
When I hear pointer I think of the object property, not the object itself... Ie |
I thought that's because we were a tree, where left right makes sense. A Zipper (from my understanding) can be used with any type of data structure. The structure isn't part of the spec per se... |
Correct, but it's part of the description. If we add a HINTS file we can clarify that in this exercise we'll be working with a
I think that was the intention. It also makes it much more likely that people will make everything immutable from the get-go 💯 |
Sure, or we could just change the example entirely. Does it really further the goals of Exercism by having one example in the readme and then an entirely different actual case to be solved? I'm not so sure. |
It doesn't. But for now this is all we can do, because I want to keep following the In |
Reference: https://exercism.io/mentor/solutions/962ebabf19e848e5bceed0533f1898ad#discussion-post-605355
We should add a test similar to:
This seems to be a pretty key thing to not test for.
I don't actually think the students exact implementation is super critical here. What they did was implement a single object with a "cursor" that kept track of where it was in the tree and acted accordingly. So that calling
left
orright
would merely update the cursor position...Which 100% works since the current tests never require that a new object be generated.
The text was updated successfully, but these errors were encountered: