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 #164

Closed
kytrinyx opened this issue Apr 7, 2016 · 2 comments · Fixed by #168
Closed

binary: improve tests for invalid numbers #164

kytrinyx opened this issue Apr 7, 2016 · 2 comments · Fixed by #168

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

@dalexj
Copy link
Contributor

dalexj commented Apr 7, 2016

we currently have:

  @tag :pending
  test "invalid binary is decimal 0" do
    assert Binary.to_decimal("carrot") == 0
  end

  @tag :pending
  test "invalid binary is decimal 0 II" do
    assert Binary.to_decimal("convert01") == 0
  end

  @tag :pending
  test "invalid binary is decimal 0 III" do
    assert Binary.to_decimal("10convert") == 0
  end

  @tag :pending
  test "22 is not a binary number" do
    assert Binary.to_decimal("22") == 0
  end

looks like this is all in place, unless "carrot" should be replaced by "1carrot0"

@kytrinyx
Copy link
Member Author

kytrinyx commented Apr 7, 2016

I think 1carrot0 should come in addition to carrot.

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

Successfully merging a pull request may close this issue.

2 participants