-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
Generating tests for "all-your-base" exercise #473
Comments
It's useful to link to a file you are discussing: https://github.com/exercism/x-common/blob/master/exercises/all-your-base/canonical-data.json |
Aren't the last examples with Can you help us by asking a specific question about a specific case? |
@stevejb71 has created a test generated and converted He probably faces similar questions, so maybe he can weigh in on the matter? |
Not necessarily, for example the leading zeros test: {
"description" : "leading zeros",
"input_base" : 7,
"input_digits" : [0, 6, 0],
"output_base" : 10,
"expected" : null
} This is a case where tracks can either implement leading zeros as valid or invalid. So in the Ruby implementation, we do allow leading zeros: def test_leading_zeros
skip
digits = [0, 6, 0]
input_base = 7
output_base = 10
expected = [4, 2]
... But the Javascript implementation does not: xit('leading zeros', function () {
expect(function () {
converter.convert([0, 6, 0], 7, 10);
}).toThrow(new Error('Input has wrong format'));
}); @dvberkel Thanks so much! I'll check out that implementation 😄 |
I also allowed leading zeroes in OCaml (it felt more natural, even though it complicates the implementation). The OCaml test generator works off a template file (one for each exercise), and substitutes in a None (OCaml equivalent of null, to indicate failure) for the null it sees in the json. Since this isn't what I wanted, I just hand-edited. I see the test generator as a tool to help in translating exercises into OCaml, and to help updating tests when the json changes, but it will still need some human intervention for certain exercises. |
Thank you so much for the help @Insti, @dvberkel, and @stevejb71! I'm going to go ahead and close this issue since, with help from you all, I was able to get this working 😄 Thanks again everyone!! |
all-your-base 1.2.0 In #280 we made the explicit choice to leave various cases `expected: null` where tracks can make their own decisions (leading zeroes, the representations of zero, whether empty sequence is acceptable as input). There are four affected cases. #473 results in a discussion that some post-processing is necessary, based on the decisions that a given track makes. One might even imagine that each individual generator may have to reimplement base translation to arrive at the proper answers for each case. To ease the process of translation, instead we make some canonical choices, explicitly show what the choices are, and offer that tracks may make a different choice if desired. A previous proposal did not receive support: #468 However, this proposal differs because it does change the comments at the top of the file. Closes #1002 by mutual exclusion
Hi there!
I've been working on adding a test generator for the
all-your-base
exercise for exercism/xruby and I've run into a bit of a snag.Everything works perfectly until I get to the last 13 (if I counted correctly) exercises that are left undefined. As far as I'm able to tell, and I certainly could be missing something, these tests aren't easy (possible?) to generate from individual tracks. Is that correct?
If so, I'm wondering if theres a way that we could add more information to the
canonical-data
so that different tracks could generate their tests based on the following (from the data documentation):Though, I'm really not to sure how that would work...
Have any other tracks successfully implemented a test generator for
all-your-base
? I looked through a couple of the other language repositories, but I wasn't able to find anything.Thank you so much for your time!!
The text was updated successfully, but these errors were encountered: