Skip to content

luhn: Make exercise schema-compliant #643

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 1 commit 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
17 changes: 16 additions & 1 deletion exercises/luhn/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,82 @@
{
"valid": [
"exercise": "luhn",
"version": "1.0.0",
"cases": [
{
"description": "single digit strings can not be valid",
"property": "valid",
"input": "1",
"expected": false
},
{
"description": "A single zero is invalid",
"property": "valid",
"input": "0",
"expected": false
},
{
"description": "a simple valid SIN that remains valid if reversed",
"property": "valid",
"input": "059",
"expected": true
},
{
"description": "a simple valid SIN that becomes invalid if reversed",
"property": "valid",
"input": "59",
"expected": true
},
{
"description": "a valid Canadian SIN",
"property": "valid",
"input": "055 444 285",
"expected": true
},
{
"description": "invalid Canadian SIN",
"property": "valid",
"input": "055 444 286",
"expected": false
},
{
"description": "invalid credit card",
"property": "valid",
"input": "8273 1232 7352 0569",
"expected": false
},
{
"description": "valid strings with a non-digit included become invalid",
"property": "valid",
"input": "055a 444 285",
"expected": false
},
{
"description": "valid strings with punctuation included become invalid",
"property": "valid",
"input": "055-444-285",
"expected": false
},
{
"description": "valid strings with symbols included become invalid",
"property": "valid",
"input": "055£ 444$ 285",
"expected": false
},
{
"description": "single zero with space is invalid",
"property": "valid",
"input": " 0",
"expected": false
},
{
"description": "more than a single zero is valid",
"property": "valid",
"input": "0000 0",
"expected": true
},
{
"description": "input digit 9 is correctly converted to output digit 9",
"property": "valid",
"input": "091",
"expected": true
}
Expand Down