Closed
Description
Our JSON schema right now most ergonomically expresses tests of the form:
The code under test, given this input, produces this exact output.
This is expressed in https://github.com/exercism/problem-specifications/blob/master/canonical-schema.json#L6-L8, which today reads:
, " optimising for the ability to represent example-based tests"
, " of the form 'function (input) == output'. Future expansions"
, " may allow for other types of tests such as property-based. "
What other types might we care about:
- The code under test, given X input, produces the same result as when it is given Y input. In other words,
f(X) == f(Y)
- diffie-hellman: Add canonical data #1224 (comment): diffie-hellman key exchange should result in two parties calculating the same secret
- zipper: add canonical data #934 (comment) and zipper: add canonical data #934 (comment): You can arrive at equal
zipper
s using two different series of operations.
- Create a thing then perform some number of operations on it, each of which should produce some expected result
- Circular-buffer circular-buffer: Add canonical data #488
- React react: Add JSON test data #358
- possibly bank-account, pending JSON: bank-account: Implement canonical-data.json #554
- Property-based tests
- diamond for sure
- possibly "answer is within this range" such as diffie-hellman's diffie-hellman: Add canonical data #1224 (comment)
- possibly "answer matches this regular expression" such as simple-cipher's simple-cipher: Add canonical data #966 (comment)
- possibly "answer is random" such as diffie-hellman's diffie-hellman: Add canonical data #1224 (comment), simple-cipher's simple-cipher: Add canonical data #966 (comment), and robot-name
- The input to a function is the output of another function, perhaps f(g(x))
- simple-cipher with its tests that
decode . encode
andencode . decode
are both identity, as described in simple-cipher: Add canonical-data.json #1241 (comment)
- simple-cipher with its tests that
- Certain strings (in either the input or output) are to be interpreted not as their literal value but in some symbolic way
- simple-cipher with things like cipher.key as in simple-cipher: Add canonical-data.json #1241 (comment)
The number of uses for each of these alternate test types is not large enough that I feel it is worth any possible proposal at this time. Therefore I'm closing this issue immediately and taking no action on it.
If you want to make it easy to make a proposal when the time is right for it, it is in your interest to continue reporting any such use cases here.
Metadata
Metadata
Assignees
Labels
No labels