You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a basic exercise generation script (bin/gen-exercise.sh) which does not yet make use of configlet create to correctly populate the new exercise's configuration files, and add blank files for the stub, tests, and example.
A more comprehensive exercise generator would:
Run configlet create to create the skeleton structure of the exercise.
Add a very basic solution stub, and replicate it as the initial example in the .meta folder.
Generate the stubs for the tests from the exercise's canonical-data.json (and possibly a similar track-specific metadata file; see below).
For the last step, each object in the cases array would correspond to a test. property would be the name of the solution's procedure that should be called (converted from camelCase to snake_case), input would specify the function's parameters and their test values, and expected would specify the expected result for the given input arguments.
The value of property and the keys of input could also be used to generate the procedure stubs in the solution stub.
@BNAndras notes that we probably want to be able to define track-specific tests, and define these in the .meta metadata folder as static definitions. Then it could be possible to regenerate the .odin files from scratch, or just add new tests if either the canonical tests or the track-specific definitions are updated:
The main thing to watch out for would be not to clobber the track-specific tests. My spur-of-the-moment though would be perhaps have an additional file in the .meta folder that contains JSON for the extra tests. Then the generator can append the generated test cases from that file to the end of the upstream test cases.
The text was updated successfully, but these errors were encountered:
There is a basic exercise generation script (
bin/gen-exercise.sh
) which does not yet make use ofconfiglet create
to correctly populate the new exercise's configuration files, and add blank files for the stub, tests, and example.A more comprehensive exercise generator would:
configlet create
to create the skeleton structure of the exercise..meta
folder.canonical-data.json
(and possibly a similar track-specific metadata file; see below).For the last step, each object in the
cases
array would correspond to a test.property
would be the name of the solution's procedure that should be called (converted from camelCase to snake_case),input
would specify the function's parameters and their test values, andexpected
would specify the expected result for the given input arguments.The value of
property
and the keys ofinput
could also be used to generate the procedure stubs in the solution stub.@BNAndras notes that we probably want to be able to define track-specific tests, and define these in the
.meta
metadata folder as static definitions. Then it could be possible to regenerate the.odin
files from scratch, or just add new tests if either the canonical tests or the track-specific definitions are updated:The text was updated successfully, but these errors were encountered: