Skip to content
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
32 changes: 26 additions & 6 deletions binary.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,34 @@
"expected": 31
},
{
"description": "numbers other than one and zero raise an error",
"binary": ["012", "2"],
"expected": -1
"description": "2 is not a valid binary digit",
"binary": "2",
"expected": null
},
{
"description": "containing letters raises an error",
"binary": ["10nope", "nope10", "10nope10", "001 nope"],
"expected": -1
"description": "a number containing a non-binary digit is invalid",
"binary": "01201",
Copy link
Copy Markdown
Contributor

@Insti Insti Jul 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The distinct cases we have here are:

  • trailing non-binary characters
  • leading non-binary characters
  • internal non-binary characters
  • a number and a word whitespace separated

They should all be included.

"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
}
]
}