nth-prime: Add JSON test data#332
Conversation
cb279cd to
bb79e10
Compare
|
👍 from me. |
| ], | ||
| "cases": [ | ||
| { | ||
| "description": "first", |
There was a problem hiding this comment.
Consistency in descriptions: either add 'prime' here or remove it for sixth and big
My preference is add it.
|
Looks good, I only have a couple of minor nitpicks with descriptions. |
|
Numbers all look correct, anyone have opinions on representing them as numbers rather than strings? Would force implementing languages to do the string -> integer parse if string, is it OK? |
|
Numbers would be better. |
bb79e10 to
1922009
Compare
|
Updated the descriptions and changed the strings to numbers 👍 |
|
From #332 (comment)
This is the "weird case": It's better to have a test in the json that is ignored by a few tracks than not have a test-case in there that is implemented by many. Does anyone else have an opinion on this? |
|
If we make it optional, let's add a json key or something to indicate that so that generators can decide to keep or skip optional exercises. I don't have an opinion in this specific case though. I tend to prefer to have the zeroth case defined, but I also like math, so I'm biased. |
|
It seems to me, at this level, we should have a field that describes valid inputs and only provide test cases of those inputs--"happy path" tests. In this case, inputs should be positive integers, language tracks should implement the failure cases. I think this would jive better with the track-dependent "difficulty" metadata that's coming up soon. |
|
But if there are good examples of failure cases, then it would be useful to document them. Perhaps under a key for just failure cases, and people can do with it what they please? |
|
@kytrinyx I kinda like that, separating the "success" from the "failure" test cases. |
|
Can we move this forward? It looks good to me. @kytrinyx |
|
Yepp, this looks great. Thanks @cacqw7! (Also thanks for the ping @catb0t) |
|
Ah, right, we'll need to move it from nth-prime.json to exercises/nth-prime/canonical-data.json |
Add list-ops exercise. There still may be some issues, see PR #332 for details.
Adding JSON test data to go along with my xruby generator