But you literally cannot possibly test that assertion for all
x. Let's take a slightly harder problem:
prove (or at least test conclusively) that for all integer x, the output y of the following function is always even:
y = x^2 + x + 2
There is essentially no way to prove this for all
x by simply testing all integers. If your integers are 64-bit, you don't have enough time in the lifespan of the universe.
On the other hand, you could simply reason through the cases: if x is even, then all terms are even. If x is odd, then x^2 is also odd, and x^2 + x = odd + odd = even. So you're done.
This is what people mean when they say "tests don't prove your code is correct" -- it's almost always better to be able to read code and prove (to some degree) that it's correct. It's really nothing like static types, which are also constructive proofs that your code is not incorrect in specific ways. (That is: it proves that your code is not [incorrect in specific ways], not that your code is [not incorrect].)
Once you prove your code correct, you can often write efficient tests with cases at the correct boundary points to make sure that proof stays correct as the code changes.