Skip to content

all-your-base: Be decisive about zeroes #1001

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

Merged
merged 2 commits into from
Nov 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions exercises/all-your-base/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"exercise": "all-your-base",
"version": "1.1.0",
"version": "1.2.0",
"comments": [
"It's up to each track do decide:",
"",
"1. What's the canonical representation of zero?",
" - []?",
" - [0]?",
"",
"2. What representations of zero are allowed?",
" - []?",
" - [0]?",
" - [0,0]?",
"This canonical data makes the following choices:",
"1. Zero is always represented in outputs as [0] instead of [].",
"2. In no other instances are leading zeroes present in any outputs.",
"3. Leading zeroes are accepted in inputs.",
"4. An empty sequence of input digits is considered zero, rather than an error.",
"",
"3. Are leading zeroes allowed?",
"Tracks that wish to make different decisions for these choices may translate appropriately.",
"",
"4. How should invalid input be handled?",
"It's up to each track do decide:",
"How should invalid input be handled?",
"",
"All the undefined cases are marked as null.",
"",
Expand Down Expand Up @@ -92,31 +88,31 @@
"input_base": 2,
"input_digits": [],
"output_base": 10,
"expected": null
"expected": [0]
},
{
"description": "single zero",
"property": "rebase",
"input_base": 10,
"input_digits": [0],
"output_base": 2,
"expected": null
"expected": [0]
},
{
"description": "multiple zeros",
"property": "rebase",
"input_base": 10,
"input_digits": [0, 0, 0],
"output_base": 2,
"expected": null
"expected": [0]
},
{
"description": "leading zeros",
"property": "rebase",
"input_base": 7,
"input_digits": [0, 6, 0],
"output_base": 10,
"expected": null
"expected": [4, 2]
},
{
"description": "first base is one",
Expand Down