Skip to content

isbn-verifier: add input objects #1053

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
Dec 30, 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
54 changes: 40 additions & 14 deletions exercises/isbn-verifier/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exercise": "isbn-verifier",
"version": "2.0.0",
"version": "2.1.0",
"comments": [
"An expected value of true indicates a valid ISBN-10, ",
"whereas false means the ISBN-10 is invalid."
Expand All @@ -9,79 +9,105 @@
{
"description": "valid isbn number",
"property": "isValid",
"input": "3-598-21508-8",
"input": {
"isbn": "3-598-21508-8"
},
"expected": true
},
{
"description": "invalid isbn check digit",
"property": "isValid",
"input": "3-598-21508-9",
"input": {
"isbn": "3-598-21508-9"
},
"expected": false
},
{
"description": "valid isbn number with a check digit of 10",
"property": "isValid",
"input": "3-598-21507-X",
"input": {
"isbn": "3-598-21507-X"
},
"expected": true
},
{
"description": "check digit is a character other than X",
"property": "isValid",
"input": "3-598-21507-A",
"input": {
"isbn": "3-598-21507-A"
},
"expected": false
},
{
"description": "invalid character in isbn",
"property": "isValid",
"input": "3-598-2K507-0",
"input": {
"isbn": "3-598-2K507-0"
},
"expected": false
},
{
"description": "X is only valid as a check digit",
"property": "isValid",
"input": "3-598-2X507-9",
"input": {
"isbn": "3-598-2X507-9"
},
"expected": false
},
{
"description": "valid isbn without separating dashes",
"property": "isValid",
"input": "3598215088",
"input": {
"isbn": "3598215088"
},
"expected": true
},
{
"description": "isbn without separating dashes and X as check digit",
"property": "isValid",
"input": "359821507X",
"input": {
"isbn": "359821507X"
},
"expected": true
},
{
"description": "isbn without check digit and dashes",
"property": "isValid",
"input": "359821507",
"input": {
"isbn": "359821507"
},
"expected": false
},
{
"description": "too long isbn and no dashes",
"property": "isValid",
"input": "3598215078X",
"input": {
"isbn": "3598215078X"
},
"expected": false
},
{
"description": "isbn without check digit",
"property": "isValid",
"input": "3-598-21507",
"input": {
"isbn": "3-598-21507"
},
"expected": false
},
{
"description": "too long isbn",
"property": "isValid",
"input": "3-598-21507-XX",
"input": {
"isbn": "3-598-21507-XX"
},
"expected": false
},
{
"description": "check digit of X should not be used for 0",
"property": "isValid",
"input": "3-598-21515-X",
"input": {
"isbn": "3-598-21515-X"
},
"expected": false
}
]
Expand Down