Skip to content
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

README: bring expectation of canonical-data.json values (description, errors, no msg) up-to-date #551

Merged
merged 3 commits into from
Feb 17, 2017

Conversation

petertseng
Copy link
Member

Note that while there is a new schema proposed in #336, it's believed by me that everything being said in this PR is still applicable even when that schema is applied:

So this may be evaluated without having to wait for #336

@petertseng petertseng changed the title README: bring expectation of canonical-data.json values up-to-date README: bring expectation of canonical-data.json values (description, errors, no msg) up-to-date Feb 12, 2017
@petertseng
Copy link
Member Author

Previous discussion of descriptions: #451 (comment)

README.md Outdated
@@ -47,9 +47,14 @@ variations.

Each test case has the the following keys:
- description: which will be used to name each generated test
- the description should not simply explain **what** each case is (that is redundant information)
- the description should explain **why** each case is there
- for example, what kinds of incorrect implementations might this case help us find?
- 'variable names': one or more variable names with values which will be passed to the solution method
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about the "will be passed to the solution method" part. Shouldn't that be "will be passed to the test method"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I guess here "solution method" means "method in the solution". In leap, we'd get "year":1996 telling us to do is_leap 1996 or isLeap(1996) or similar. I do think "solution method" makes more sense than "test method". Basically I think it's to make clear that it's what the student wrote and is submitting.

If it still bears improvement, maybe I could offer "function under test", or simply "the submitted function" (maybe too specific, if not all submissions are single functions). I would have also offered "the student's function" but that canonicalises the student word that I use, whereas other people use others (practitioner, exercist, user...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Good point then.

@ErikSchierboom
Copy link
Member

This PR seems like a great improvement.

README.md Outdated
- expected: the expected result (this would be -1 when we expect an exception)
- msg: a nice message for the failing case
- expected: the expected result
- if an error is expected, the value at `"expected"` should be an object containing exactly one property, `"error"`, whose value is a string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this proposal, how should one differentiate between a missing value (optional return) and an error? Is it possible, or both should use the same structure?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a point of attention to me. In #336 I suggest to use null as the value to represent a missing value. Languages with support for optional types can then use their optional type instead of null.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's talk at #336 (comment) shall we!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I rubber-ducked myself into finding a reasonable answer. I've added the possibility of null, on the assumption that my guess is correct. I'm very open to corrections, of course.

README.md Outdated
@@ -47,9 +47,14 @@ variations.

Each test case has the the following keys:
- description: which will be used to name each generated test
- the description should not simply explain **what** each case is (that is redundant information)
- the description should explain **why** each case is there
- for example, what kinds of incorrect implementations might this case help us find?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to belong to the line above (about the why). Should it really be on a new line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, there is no good reason to put it on another

We would also need to clean up remaining instances, so this is necessary
but not sufficient for #401.

This relates to discussions in #338 about how to distinguish between
`null` and error cases.
This isn't used anymore. Grep for `msg` and the only instance seen is
rail-fence-cipher, and it's used as an input in that case,o

Evidence of our past intent to remove the `msg` key:

* #163
* [2dee540][cmt1]
* [1483fe9][cmt2]

[cmt1]: 2dee540
[cmt2]: 1483fe9
@ErikSchierboom
Copy link
Member

I think this looks great now!

- expected: the expected result (this would be -1 when we expect an exception)
- msg: a nice message for the failing case
- expected: the expected result
- if the input is valid but there is no result for the input, the value at `"expected"` should be `null`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the last proposal in #336 doesn't enforce the existence of a expected property, if it is present, it can now also be null.

@ErikSchierboom
Copy link
Member

I think we can merge this now, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants