'Tests that the error counter works as expected.'

def testCountWordErrors(self):

    truth_str = 'farm    barn'
    counts = ec.CountWordErrors(ocr_text=truth_str, truth_text=truth_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=0, fp=0, truth_count=2, test_count=2))
    dot_str = 'farm    barn.'
    counts = ec.CountWordErrors(ocr_text=dot_str, truth_text=truth_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=1, fp=1, truth_count=2, test_count=2))
    counts = ec.CountWordErrors(ocr_text=truth_str, truth_text=dot_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=1, fp=1, truth_count=2, test_count=2))
    no_space = 'farmbarn'
    counts = ec.CountWordErrors(ocr_text=no_space, truth_text=truth_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=2, fp=1, truth_count=2, test_count=1))
    counts = ec.CountWordErrors(ocr_text=truth_str, truth_text=no_space)
    self.assertEqual(counts, ec.ErrorCounts(fn=1, fp=2, truth_count=1, test_count=2))
    counts = ec.CountWordErrors(ocr_text='', truth_text=truth_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=2, fp=0, truth_count=2, test_count=0))
    counts = ec.CountWordErrors(ocr_text=truth_str, truth_text='')
    self.assertEqual(counts, ec.ErrorCounts(fn=0, fp=2, truth_count=0, test_count=2))
    sp_str = 'farm    ba    rn'
    counts = ec.CountWordErrors(ocr_text=sp_str, truth_text=truth_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=1, fp=2, truth_count=2, test_count=3))
    counts = ec.CountWordErrors(ocr_text=truth_str, truth_text=sp_str)
    self.assertEqual(counts, ec.ErrorCounts(fn=2, fp=1, truth_count=3, test_count=2))
