Skip to content
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

binary: improve tests for invalid numbers #111

Closed
kytrinyx opened this issue Apr 7, 2016 · 10 comments
Closed

binary: improve tests for invalid numbers #111

kytrinyx opened this issue Apr 7, 2016 · 10 comments
Assignees

Comments

@kytrinyx
Copy link
Member

kytrinyx commented Apr 7, 2016

We should have separate tests for:

  • alphabetic characters at the beginning of a valid binary number
  • alphabetic characters at the end of a valid binary number
  • alphabetic characters in the middle of an otherwise valid binary number
  • invalid digits (e.g. 2)

If the test suite for binary has test cases that cover these edge cases, this issue can safely be closed.

See exercism/problem-specifications#95

@wobh
Copy link
Contributor

wobh commented Apr 7, 2016

The test suite doesn't cover these cases.

One wrinkle. A submission might use the standard parse-integer which would allow an optional + or - to precede the number and whitespace on either side. Further, parse-integer has a junk-allowed flag so that it will parse the first contiguous numerals it finds in the string (and + or - preceding as before).

http://l1sp.org/cl/parse-integer

@verdammelt
Copy link
Member

These new requirements will make it more complicated than simply using parse-integer

@kytrinyx
Copy link
Member Author

kytrinyx commented Apr 7, 2016

@verdammelt is that a bad thing? The original reason I added this was for newbie programmers to actually have to figure out how binary numbers work.

@wobh
Copy link
Contributor

wobh commented Apr 7, 2016

I think it's also good for newbies to understand and use standard tools. I often see (and write) other iterations that implement the exercise more literally. We're also discussing it here: #107

@kytrinyx
Copy link
Member Author

kytrinyx commented Apr 7, 2016

There are other exercises that assume binary and would be good to use the standard tools for (secret handshake, I think, does this. Also maybe allergies, though I think maybe that's just bitwise, so the inputs are decimal but you're expected to think about them in binary).

@verdammelt verdammelt self-assigned this Jul 9, 2016
@kytrinyx
Copy link
Member Author

@verdammelt
Copy link
Member

@kytrinyx good timing - i was literally (and I do mean literally) about to work on this issue. How did you know?

@kytrinyx
Copy link
Member Author

Hah! That's a delightful coincidence. I've been catching up on email for three days straight, basically, and just accidentally got to this one.

@verdammelt
Copy link
Member

verdammelt commented Jul 17, 2016

Decided to go ahead and push these changes anyway. Not sure how long getting all-your-base exercise out the door will take (ref: exercism/x-common#279.)

@kytrinyx
Copy link
Member Author

Yeah, good call. It could be a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants