It isn't. It is the evidence that calculations in the code were done correctly.
It is like the problems in high school math class. The teacher controls the inputs so that the outputs are known. The teacher then runs the test problem past the student (aka the code). If the known correct answer isn't generated then we know the student didn't do it right.
Then, why don't you apply that way to the output? You don't need tests if you only need to do it once.
Isn't that what we are discussing, how to tell if a piece of code works? You could do a formal proof that the code works (which is long and tedious) or you can test it (less long and tedious but less rigorous).
>You don't need tests if you only need to do it once.
It doesn't matter how many times you plan on running it. What counts is how much we value the output. I wouldn't bet $20 that untested code works correctly.
Similarly, even such simple test harnesses help when yourself or other go to modify the code. Having flags for "Did I break something" is very important.