Tests can't ensure the correctness of an algorithm, only that it gives the correct output on a specific input.
Known as boundary value testing, you partition all input into equivalence classes, then make sure your tests contain a sample from each class.
And even ignoring that problem, there may be an infinite amount of equivalence classes when you introduce loops/recursion, as the loops can run a different amount of times and thus lead to different executions.
Even just considering `if` statements, the amount of equivalence classes can be exponential in the amount of `if` (for example consider a series of `if` where each check a different bit of the input; ultimately you'll need any combination of bits to check every combination of `if`, and the number is 2^number of ifs).