title: How do you tell that your unit tests are correct?
body: <p>I've only done minor unit testing at various points in my career.  Whenever I start diving into it again, it always troubles me how to prove that my tests are correct.  How can I tell that there isn't a bug in my unit test?  Usually I end up running the app, proving it works, then using the unit test as a sort of regression test.  What is the recommended approach and/or what is the approach you take to this problem?</p>
  
  <p>Edit: I also realize that you could write small, granular unit tests that would be easy to understand. However, if you assume that small, granular code is flawless and bulletproof, you could just write small, granular programs and not need unit testing.</p>
  
  <p>Edit2: For the arguments "unit testing is for making sure your changes don't break anything" and "this will only happen if the test has the exact same flaw as the code", what if the test overfits? It's possible to pass both good and bad code with a bad test.  My main question is what good is unit testing since if your tests can be flawed you can't really improve your confidence in your code, can't really prove your refactoring worked, and can't really prove that you met the specification?</p>