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.