-
-
Notifications
You must be signed in to change notification settings - Fork 561
luhn: Add more tests #522
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: Add more tests #522
Changes from all commits
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 |
|---|---|---|
|
|
@@ -10,6 +10,11 @@ | |
| "input": "0", | ||
| "expected": false | ||
| }, | ||
| { | ||
| "description": "simple valid sin", | ||
| "input": " 5 9 ", | ||
| "expected": true | ||
| }, | ||
| { | ||
| "description": "valid Canadian SIN", | ||
| "input": "046 454 286", | ||
|
|
@@ -29,6 +34,36 @@ | |
| "description": "valid strings with a non-digit added become invalid", | ||
| "input": "046a 454 286", | ||
| "expected": false | ||
| }, | ||
| { | ||
| "description": "punctuation is not allowed", | ||
| "input": "055-444-285", | ||
| "expected": false | ||
| }, | ||
| { | ||
| "description": "symbols are not allowed", | ||
| "input": "055£ 444$ 285", | ||
| "expected": false | ||
| }, | ||
| { | ||
| "description": "single zero with space is invalid", | ||
| "input": " 0", | ||
| "expected": false | ||
| }, | ||
| { | ||
| "description": "lots of zeros are valid", | ||
| "input": " 00000", | ||
| "expected": true | ||
| }, | ||
| { | ||
| "description": "another valid sin", | ||
| "input": "055 444 285", | ||
|
Member
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. can you confirm - what does this test that above cases do not? is it just here to contrast with
Contributor
Author
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. Part of it was the contrast with I can remove it if necessary. |
||
| "expected": true | ||
| }, | ||
| { | ||
| "description": "nine doubled is nine", | ||
|
Member
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 case anyone wonder, this caught a bug in mine (I was using mod 9 after doubling, which turns nine into zero instead of nine) |
||
| "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.
can I get a confirmation on whether the £ is in ASCII? I am seeing bytes 0xc2 0xa3 for it
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.
It is not.