proverb: Add canonical data.#994
Conversation
This is based on the Rust tests as implemented in exercism/rust#380. The lack of canonical data had resulted in odd custom tests being designed, which was reported in exercism/rust#379.
|
A couple of things that came up during #983 might be appropriate here:
See the canonical-data.json for food-chain as an example. |
| "property": "construct" | ||
| }, | ||
| { | ||
| "description": "three pieces modernized", |
There was a problem hiding this comment.
There seem to be four pieces in the array.
|
It's useful to link to the description: https://github.com/exercism/problem-specifications/blob/master/exercises/proverb/description.md |
| { | ||
| "description": "full proverb", | ||
| "expected": "For want of a nail the shoe was lost.\nFor want of a shoe the horse was lost.\nFor want of a horse the rider was lost.\nFor want of a rider the message was lost.\nFor want of a message the battle was lost.\nFor want of a battle the kingdom was lost.\nAnd all for the want of a nail.", | ||
| "input": [ |
There was a problem hiding this comment.
This method of input is not really specified in the description and is an implementation detail.
We either need to:
- Update the description to specify that you will be provided with a list of items.
- Change the tests so we're just testing for the specified verses. (see also food-chain.)
I think in order to differentiate this exercise from food-chain it might be good to use the "list of items" version.
cc: @ErikSchierboom
There was a problem hiding this comment.
@Insti I agree that having a different input here makes for a more interesting exercise. The existing exercises are quite similar, so having some variety is nice.
There was a problem hiding this comment.
So the description should also be updated to clarify the problem.
- name the method 'recite' - expect output as an array of strings without newlines - move exercise, version properties to the top - rename 'three pieces modernized' to 'four pieces modernized', for accuracy - add comment regarding output format - add link to problem description
- Eliminate bogus word 'horseshoe' from last line of example proverb - Add text noting that the inputs may vary
|
@Insti Good ideas all; I've incorporated all of them. |
| "cases": [ | ||
| { | ||
| "description": "zero pieces", | ||
| "expected": [ |
There was a problem hiding this comment.
I was considering to ask that this should have zero elements, but given that this is converted to a string by joining all elements with newlines, then [""] and [] are both representations of the empty string, so do whatever you want.
| "property": "recite" | ||
| } | ||
| ], | ||
| "description": "Construct a proverb of the form 'for want of an X, the Y was lost'" |
There was a problem hiding this comment.
I wonder if someone will miss this at the crucial time because it's on the bottom. But I don't think it's necessary at all. I would remove it and remove one level of cases nesting.
There was a problem hiding this comment.
The description doesn't say that the lines of the proverb could vary, only the "input".
- Remove empty string from output - Un-nest cases - Move inner cases description to problemset comment - Amplify inner cases description - Re-order case fields for more sensible reading
| "For want of a pin the gun was lost.", | ||
| "For want of a gun the soldier was lost.", | ||
| "For want of a soldier the battle was lost.", | ||
| "And all for the want of a pin." |
There was a problem hiding this comment.
Is it to be presumed that the proverb is not set in stone? The description only refers to a single proverb and makes not mention that the "input" provided might refer to a different proverb. I don't think "four pieces modernized" should be included unless the description is also updated.
There was a problem hiding this comment.
@coriolinus my apologies! I didn't read closely enough. You are passing the expected proverb.
ugh, I just need to slow down. My original concern still stands. With the "input" provided how are we to know that it is for a different proverb when only one proverb is described in the description.
There was a problem hiding this comment.
@rpottsoh I did update the description for that: "your solution should be able to handle lists of arbitrary length and content".
In short, the idea is to ensure that students won't just hard-code the entire poem as a list, and then return its last N items, where N is the length of the input list. The goal of the exercise is to ensure that they can manipulate strings.
This also helps distinguish this exercise from others; discussion here was in favor of keeping the input list.
There was a problem hiding this comment.
Thanks @coriolinus for clearing this up for me. I have not worked this exercise yet so some of the what was getting past me. Thanks for taking the time to produce the canonical data for this exercise.
| "lines together with line breaks. ", | ||
| "All cases expect the student to construct a proverb of the form ", | ||
| "'For want of an X, the Y was lost.', terminating with the stock phrase ", | ||
| "'And all for the want of a Z.'" |
There was a problem hiding this comment.
Looks like Z is a special case for one of the inputs - could be worth specifically calling that out in the description.md
There was a problem hiding this comment.
No? I don't understand your comment; all inputs of non-zero length terminate with that stock phrase.
There was a problem hiding this comment.
The description.md doesn't specifically draw any explicit connection between the last line and the first input. This especially is confusing if you are aware of the proverb IRL, where the inputs are always the same and the last line is always "And all for the want of a nail".
Going solely by the description, it seems like Z should always be "nail" but that is not the case. Yes, the data implicitly makes this a requirement in a single case - but surely the data should be informed by the requirement (i.e. the description) rather than it introducing a requirement by itself?
What I mean to say is that by the description it is obvious that the inputs affect X and Y, but it is not obvious that they affect Z; Z is really X[0] so to speak.
I should have added this note against the description.md rather than this line I realise 😅
There was a problem hiding this comment.
I see now what you mean, though I'm not sure that I agree: the obvious terminating phrase, to me, would always be f"And all for the want of a {input[0]}.". Still, I don't mind adding a bit of text to the description to make that more clear.
There was a problem hiding this comment.
The description.md specifies the problem so I think you can just remove these 3 lines (8-10) from the config.json.
|
Thanks @coriolinus ❤️ |
Actually, the canonical data was born from the Rust implementation. exercism/problem-specifications#994 1.1.0 moves inputs to the `input` object. exercism/problem-specifications#1157 The Rust track has all the canonical tests, although in a different order. Reviewers should indicate whether an ordering change in the Rust tests is desired.
This is based on the Rust tests as implemented in exercism/rust#380.
The lack of canonical data had resulted in odd custom tests being
designed, which was reported in exercism/rust#379.
Closes #578.