Refactor exercises to match canonical data
See original GitHub issueThere are a number of exercises that fall into one of the following cases:
Function names that differ from those specified in the canonical data
armstrong-numbers
uses is_armstrong
instead of is_armstrong_number
:
From the canonical-data:
{
"description": "Zero is an Armstrong number",
"property": "isArmstrongNumber",
"input": {
"number": 0
},
"expected": true
},
*Note: in these cases, the camelCase names used in the canonical data should be converted to snake_case names in the tests, example solution, and solution stub.
Test input format differs from canonical data
tournament
passes a multiline string instead of a list of single-line strings.
From the canonical-data:
{
"description": "There can be more than one winner",
"property": "tally",
"input": {
"rows": [
"Allegoric Alaskans;Blithering Badgers;loss",
"Allegoric Alaskans;Blithering Badgers;win"
]
},
"expected": [
"Team | MP | W | D | L | P",
"Allegoric Alaskans | 2 | 1 | 0 | 1 | 3",
"Blithering Badgers | 2 | 1 | 0 | 1 | 3"
]
},
Test output format differs from canonical data
saddle-points
expects a set of tuples instead of a list of dict objects
From the canonical-data:
{
"description": "Can identify single saddle point",
"comments": [
"This is the README example."
],
"property": "saddlePoints",
"input": {
"matrix": [
[9, 8, 7],
[5, 3, 2],
[6, 6, 7]
]
},
"expected": [
{
"row": 2,
"column": 1
}
]
},
Test input order differs from canonical data
change
uses the order target, coins
instead of coins, target
From the canonical-data:
{
"description": "single coin change",
"property": "findFewestCoins",
"input": {
"coins": [1, 5, 10, 25, 100],
"target": 25
},
"expected": [25]
},
In an effort to simplify the job of the WIP test generator, it would be beneficial to reduce these inconsistencies now, so that it does not become the job of the generator PR to correct example solutions and stubs that do not match newly generated tests.
Here is the full list of exercises in which this occurs
- alphametics
- armstrong-numbers
- binary-search
- bob
- book-store
- change
- collatz-conjecture
- crypto-square
- diamond
- difference-of-squares
- dominoes
- gigasecond
- grains
- grep
- isbn-verifier
- knapsack
- leap
- list-ops
- markdown
- meetup
- minesweeper
- nth-prime
- palindrome-products
- prime-factors
- pythagorean-triplet
- raindrops
- rectangles
- roman-numerals
- saddle-points
- secret-handshake
- sieve
- spiral-matrix
- sublist
- ~sum-of-multiples~ (foregoing updates for now)
- tournament
- transpose
- triangle
- two-fer
- word-count
- wordy
- yacht
This issue may be considered resolved once all of the above issues have been updated to match the canonical properties.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (16 by maintainers)
Top GitHub Comments
Nope; the decision was made to not require students to use exact error message, only to have a message present. It’s up to mentors then to comment on whether the exception messages match the case.
@Grociu regarding
two-fer
, the mismatch is in the choice to usename=""
as the null case rather thanname=None