Chris's Wiki :: blog/programming/FalsifiableUnitTests Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/FalsifiableUnitTests?atomcommentsDWiki2011-10-01T09:55:16ZRecent comments in Chris's Wiki :: blog/programming/FalsifiableUnitTests.From 78.35.25.18 on /blog/programming/FalsifiableUnitTeststag:CSpace:blog/programming/FalsifiableUnitTests:569de31e5b99bc49161f2b21b5445bf67a3a2e55From 78.35.25.18<div class="wikitext"><blockquote><p>Although it’s not literally the case, we have essentially formed a non-falsifiable hypothesis without noticing and are cheerfully testing it.</p>
</blockquote>
<p>But you didn’t. The hypothesis that <code>isprime()</code> returns <code>True</code> for prime numbers and is undefined for others is equally as falsifiable as the hypothesis that it returns <code>True</code> for prime numbers and <code>False</code> for others. All you need to falsify it is to find one prime number for which <code>isprime()</code> returns <code>False</code>.</p>
<p>In fact I can’t think of any properly working unit test that tests a non-falsifiable hypothesis, since unit tests are all about falsifying some sort of statement. For that you would have to have tests that can fail randomly (for some definition of random) without the failure revealing a bug in the code. That’s certainly a popular kind of problematic test, but it’s not what’s going on in your case.</p>
<p>—<a href="http://plasmasturm.org/">Aristotle Pagaltzis</a></p>
</div>2011-10-01T09:55:16ZBy Chris Siebenmann on /blog/programming/FalsifiableUnitTeststag:CSpace:blog/programming/FalsifiableUnitTests:4162151c8dc0ca7dfca15654eb5e6db10e73689cChris Siebenmann<div class="wikitext"><p>Oops! What an embarrassing error. Now corrected, thanks.</p>
<p>(And here I carefully looked up a higher prime and even at one point
looked for a low odd non-prime, yet completely failed to notice
that 9 was not prime.)</p>
</div>2011-09-30T12:32:26ZFrom 87.194.122.82 on /blog/programming/FalsifiableUnitTeststag:CSpace:blog/programming/FalsifiableUnitTests:aa4fa016e06a5de175ef02c92c6b0dcc84171e3bFrom 87.194.122.82<div class="wikitext"><p>Draw what conclusions you will from my typo. :-P</p>
</div>2011-09-30T08:45:08ZFrom 82.132.210.165 on /blog/programming/FalsifiableUnitTeststag:CSpace:blog/programming/FalsifiableUnitTests:7565004479e0b3e6271a6ad945bb359c19b1daf4From 82.132.210.165<div class="wikitext"><p>That test should fail once... 9 isn't prime.</p>
<p>Probably sats something about the error rate in humans.</p>
</div>2011-09-30T08:03:46Z