title: Should I use real or sample data for unit tests?
body: <p>I'm writing a parser for the output of a legacy application, and since there are no specs on the file syntax I've got as many samples of these files as I could.</p>
  
  <p>Now I'm writing the unit tests before implementing the parser (because there is no other sane way to do this) but I'm not sure whether I should:</p>
  
  <ul>
  <li>use the real files produced by the application, reading from them and comparing the output with the output that I would store in json format in another file. </li>
  <li>or create a sample string with the tokens and possibilities I want to test and a dict (this is python) with the expected output.</li>
  </ul>
  
  <p>I'm inclined to use the second alternative because I would test only what I need to, without all the "real-world" data included on the actual files, but I'm afraid I could forget to test for one possibility or another.</p>
  
  <p>What do you think?</p>