Skip to content

binary: Make exercise schema-compliant #644

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
Mar 7, 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
171 changes: 94 additions & 77 deletions exercises/binary/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,96 @@
{
"decimal": [
{
"description": "binary 0 is decimal 0",
"binary": "0",
"expected": 0
},
{
"description": "binary 1 is decimal 1",
"binary": "1",
"expected": 1
},
{
"description": "binary 10 is decimal 2",
"binary": "10",
"expected": 2
},
{
"description": "binary 11 is decimal 3",
"binary": "11",
"expected": 3
},
{
"description": "binary 100 is decimal 4",
"binary": "100",
"expected": 4
},
{
"description": "binary 1001 is decimal 9",
"binary": "1001",
"expected": 9
},
{
"description": "binary 11010 is decimal 26",
"binary": "11010",
"expected": 26
},
{
"description": "binary 10001101000 is decimal 1128",
"binary": "10001101000",
"expected": 1128
},
{
"description": "binary ignores leading zeros",
"binary": "000011111",
"expected": 31
},
{
"description": "2 is not a valid binary digit",
"binary": "2",
"expected": null
},
{
"description": "a number containing a non-binary digit is invalid",
"binary": "01201",
"expected": null
},
{
"description": "a number with trailing non-binary characters is invalid",
"binary": "10nope",
"expected": null
},
{
"description": "a number with leading non-binary characters is invalid",
"binary": "nope10",
"expected": null
},
{
"description": "a number with internal non-binary characters is invalid",
"binary": "10nope10",
"expected": null
},
{
"description": "a number and a word whitespace spearated is invalid",
"binary": "001 nope",
"expected": null
}
]
"exercise": "binary",
"version": "1.0.0",
"cases": [
{
"description": "binary 0 is decimal 0",
"property": "decimal",
"binary": "0",
"expected": 0
},
{
"description": "binary 1 is decimal 1",
"property": "decimal",
"binary": "1",
"expected": 1
},
{
"description": "binary 10 is decimal 2",
"property": "decimal",
"binary": "10",
"expected": 2
},
{
"description": "binary 11 is decimal 3",
"property": "decimal",
"binary": "11",
"expected": 3
},
{
"description": "binary 100 is decimal 4",
"property": "decimal",
"binary": "100",
"expected": 4
},
{
"description": "binary 1001 is decimal 9",
"property": "decimal",
"binary": "1001",
"expected": 9
},
{
"description": "binary 11010 is decimal 26",
"property": "decimal",
"binary": "11010",
"expected": 26
},
{
"description": "binary 10001101000 is decimal 1128",
"property": "decimal",
"binary": "10001101000",
"expected": 1128
},
{
"description": "binary ignores leading zeros",
"property": "decimal",
"binary": "000011111",
"expected": 31
},
{
"description": "2 is not a valid binary digit",
"property": "decimal",
"binary": "2",
"expected": null
},
{
"description": "a number containing a non-binary digit is invalid",
"property": "decimal",
"binary": "01201",
"expected": null
},
{
"description": "a number with trailing non-binary characters is invalid",
"property": "decimal",
"binary": "10nope",
"expected": null
},
{
"description": "a number with leading non-binary characters is invalid",
"property": "decimal",
"binary": "nope10",
"expected": null
},
{
"description": "a number with internal non-binary characters is invalid",
"property": "decimal",
"binary": "10nope10",
"expected": null
},
{
"description": "a number and a word whitespace spearated is invalid",
"property": "decimal",
"binary": "001 nope",
"expected": null
}
]
}