-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generator: retain nested test case structure (#1889)
Previously, the generator flattened any nesting of test cases from problem-specifications. This worked alright for medium-complexity exercises. However, it makes writing a functional test template harder in the general case. An example is the exercise `forth`, which has test cases with _the same description_ across different test groups. Flattening the groups leads to tests with the same name being generated. Preserving the structure makes it possible to organize the tests into one module per test group, solving the naming conflicts.
- Loading branch information
Showing
15 changed files
with
144 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 17 additions & 12 deletions
29
exercises/practice/rail-fence-cipher/.meta/additional-tests.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
[ | ||
{ | ||
"uuid": "46dc5c50-5538-401d-93a5-41102680d068", | ||
"description": "encode wide characters", | ||
"comments": [ | ||
"Unicode tests are not suitable to be upstreamed.", | ||
"Handling unicode is tedious in many languages." | ||
], | ||
"property": "encode", | ||
"input": { | ||
"msg": "古池蛙飛び込む水の音", | ||
"rails": 3 | ||
}, | ||
"expected": "古びの池飛込水音蛙む" | ||
"description": "unicode", | ||
"cases": [ | ||
{ | ||
"uuid": "46dc5c50-5538-401d-93a5-41102680d068", | ||
"description": "encode wide characters", | ||
"comments": [ | ||
"Unicode tests are not suitable to be upstreamed.", | ||
"Handling unicode is tedious in many languages." | ||
], | ||
"property": "encode", | ||
"input": { | ||
"msg": "古池蛙飛び込む水の音", | ||
"rails": 3 | ||
}, | ||
"expected": "古びの池飛込水音蛙む" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 54 additions & 49 deletions
103
exercises/practice/triangle/.meta/additional-tests.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,57 @@ | ||
[ | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "all zero sides is not a triangle", | ||
"comments": ["reimplements 16e8ceb0-eadb-46d1-b892-c50327479251"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [0, 0, 0] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "first triangle inequality violation", | ||
"comments": ["reimplements 2eba0cfb-6c65-4c40-8146-30b608905eae"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [1, 1, 3] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "second triangle inequality violation", | ||
"comments": ["reimplements 278469cb-ac6b-41f0-81d4-66d9b828f8ac"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [1, 3, 1] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "third triangle inequality violation", | ||
"comments": ["reimplements 90efb0c7-72bb-4514-b320-3a3892e278ff"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [3, 1, 1] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "may not violate triangle inequality", | ||
"comments": ["reimplements 70ad5154-0033-48b7-af2c-b8d739cd9fdc"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [7, 3, 2] | ||
}, | ||
"expected": false | ||
"description": "invalid triangle", | ||
"cases": [ | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "all zero sides is not a triangle", | ||
"comments": ["reimplements 16e8ceb0-eadb-46d1-b892-c50327479251"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [0, 0, 0] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "first triangle inequality violation", | ||
"comments": ["reimplements 2eba0cfb-6c65-4c40-8146-30b608905eae"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [1, 1, 3] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "second triangle inequality violation", | ||
"comments": ["reimplements 278469cb-ac6b-41f0-81d4-66d9b828f8ac"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [1, 3, 1] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "third triangle inequality violation", | ||
"comments": ["reimplements 90efb0c7-72bb-4514-b320-3a3892e278ff"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [3, 1, 1] | ||
}, | ||
"expected": false | ||
}, | ||
{ | ||
"uuid": "3ddc03ad-4066-41b0-8ba2-1b0ce0146064", | ||
"description": "may not violate triangle inequality", | ||
"comments": ["reimplements 70ad5154-0033-48b7-af2c-b8d739cd9fdc"], | ||
"property": "invalid", | ||
"input": { | ||
"sides": [7, 3, 2] | ||
}, | ||
"expected": false | ||
} | ||
] | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.