Pull request: Fixed Collatz Conjecture tests that disallowed correct answers

The tests assume that there can be only one way to solve the problem: if the number is even, divide it by 2 and if the number is odd, multiply it by 3 and add 1.

Multiplying by 3 and adding 1 can cause an overflow, which the tests accommodate by allowing None as a correct response whenever u64 overflows occur.

The problem is that None is considered to be the only correct response in that case, when every nonzero u64 has a correct answer that can be put into Some. For example, overflow can be avoided by converting the input u64 into a u128 and then getting the result using u128 arithmetic.

This commit corrects the tests so that either None or the correct answer is allowed when u64 overflow can occur. All code that already passed the old tests will also pass the corrected tests.


The changes can be seen at the pull request.

Those tests should probably be synced to match the canonical data, as this is a practice exercise.

I don’t have time right now, but my first thought is that these tests were added in addition to problem-specifications. If they are no good, probably better to drop them entirely. I look at it later, hopefully tomorrow. Thanks for the report!

@ChaiTRex Thank you for the report. I opened a PR which deletes the tests instead.