Skip to content

binary: split error case tests#305

Merged
Insti merged 1 commit intoexercism:masterfrom
tommyschaefer:binary/split-error-test-cases
Jul 28, 2016
Merged

binary: split error case tests#305
Insti merged 1 commit intoexercism:masterfrom
tommyschaefer:binary/split-error-test-cases

Conversation

@tommyschaefer
Copy link
Copy Markdown
Contributor

@tommyschaefer tommyschaefer commented Jul 28, 2016

Resolves #303

Does this seem like it covers all of the cases in the original? It felt to me like a number of the grouped assertions were testing the same thing, so I didn't include them all. I'm totally open to adding them, I just couldn't think of distinct names for all of them 😄!

Also, there has been some discussion about what the expected value should be. Both null and -1 seem appropriate to me. I only chose to go with -1 because I saw it used in the hamming data, so I assumed that was the standard. If this isn't the case, I'm happy to change it!

Thank you so much for your time and feedback! 😄

@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

Thanks @tommyschaefer .

In this case I believe -1 is inappropriate because it is a valid decimal number, and it is possible to represent negative numbers in binary. (Although this exercise is only concerned with positive binary numbers.)

So null is a better return value to indicate invalid input.

I agree with what you've done to remove redundant test cases, nice work.
Edit: and I've made some suggestions about other named tests to include.

Comment thread binary.json Outdated
"description": "numbers other than one and zero raise an error",
"binary": ["012", "2"],
"expected": -1
"description": "2 is not a valid binary digit and raises an error",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd remove 'and raises an error' from the descriptions.
The error raising is an extension added by the Ruby track.

The readme just says "The program should handle invalid inputs."

tommyschaefer added a commit to tommyschaefer/xruby that referenced this pull request Jul 28, 2016
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

Looking good. 👍

@tommyschaefer
Copy link
Copy Markdown
Contributor Author

@Insti Thank you! Would it be helpful if I squashed these commits?

@Insti Insti added the ready label Jul 28, 2016
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

Yes please.

* Update binary tests to make one assertion per test
* Use null to indicate invalid input rather than -1
@tommyschaefer tommyschaefer force-pushed the binary/split-error-test-cases branch from 01092b0 to 905d77a Compare July 28, 2016 19:59
@tommyschaefer
Copy link
Copy Markdown
Contributor Author

Commits have been squashed and I updated the PR description so that if / when this gets merged, #303 should also be closed 😀

tommyschaefer added a commit to tommyschaefer/xruby that referenced this pull request Jul 28, 2016
* Regenerate tests from latest exercism/problem-specifications#305 revision
* Remove compound assertion logic from BinaryCases since all tests
  with multiple assertions have been split into separate tests.
* Use JSON null to indicate invalid input
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

🤞

@Insti Insti closed this Jul 28, 2016
Insti pushed a commit to exercism/ruby that referenced this pull request Jul 28, 2016
* Regenerate tests from latest exercism/problem-specifications#305 revision
* Remove compound assertion logic from BinaryCases since all tests
  with multiple assertions have been split into separate tests.
* Use JSON null to indicate invalid input
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

They didn't close automatically, but since you reminded me I remembered to do it manually.
Thanks for all your work on this @tommyschaefer.

@tommyschaefer
Copy link
Copy Markdown
Contributor Author

Hmm... I think this might have just gotten closed rather than merged. Is that intentional?

And my pleasure, @Insti! 😄

@Insti Insti reopened this Jul 28, 2016
@Insti Insti merged commit 93da811 into exercism:master Jul 28, 2016
@Insti
Copy link
Copy Markdown
Contributor

Insti commented Jul 28, 2016

Gak! Thanks for spotting that!
(And that might have been why it didn't automatically close those others..)
More 🌟 🌟 for you.

@tommyschaefer tommyschaefer deleted the binary/split-error-test-cases branch July 28, 2016 20:28
@tommyschaefer
Copy link
Copy Markdown
Contributor Author

Haha! No problem 😄 Thank you so much for all of your help and feedback 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants