-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
luhn: tweak canonical tests #547
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
"expected": false | ||
}, | ||
{ | ||
"description": "simple valid sin", | ||
"description": "simple valid SIN", | ||
"input": " 5 9 ", | ||
"expected": true | ||
}, | ||
|
@@ -20,6 +20,11 @@ | |
"input": "046 454 286", | ||
"expected": true | ||
}, | ||
{ | ||
"description": "another valid Canadian SIN", | ||
"input": "055 444 285", | ||
"expected": true | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the PR that added this test, the following reasoning was given:
I moved it earlier in the suite so that it is more likely encountered by someone who is still trying to work out the algorithm, and updated the language in the test cases that contrast with this one to make that comparison more clear. |
||
{ | ||
"description": "invalid Canadian SIN", | ||
"input": "046 454 287", | ||
|
@@ -31,17 +36,17 @@ | |
"expected": false | ||
}, | ||
{ | ||
"description": "valid strings with a non-digit added become invalid", | ||
"description": "valid strings with a non-digit included become invalid", | ||
"input": "046a 454 286", | ||
"expected": false | ||
}, | ||
{ | ||
"description": "punctuation is not allowed", | ||
"description": "valid strings with punctuation included become invalid", | ||
"input": "055-444-285", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compare to valid case |
||
"expected": false | ||
}, | ||
{ | ||
"description": "symbols are not allowed", | ||
"description": "valid strings with symbols included become invalid", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compare to valid case |
||
"input": "055£ 444$ 285", | ||
"expected": false | ||
}, | ||
|
@@ -51,17 +56,12 @@ | |
"expected": false | ||
}, | ||
{ | ||
"description": "lots of zeros are valid", | ||
"input": " 00000", | ||
"expected": true | ||
}, | ||
{ | ||
"description": "another valid sin", | ||
"input": "055 444 285", | ||
"description": "more than a single zero is valid", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to state the limitation here more clearly, and moved the space character to indicate that a "chain" of zeros is not required. |
||
"input": "00 000", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
"expected": true | ||
}, | ||
{ | ||
"description": "nine doubled is nine", | ||
"description": "input digit 9 is correctly converted to output digit 9", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nine doubled is not nine; tried to make this a little more explicit! |
||
"input": "091", | ||
"expected": true | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalized
sin
->SIN
throughout.