import unittest
import numpy as np
from r50_worm_overlap import matching

class MatchingTest(unittest.TestCase):
 def test_one_candidate_cannot_match_two_references(self):
  a=np.array([[1,1,0]],dtype=bool);b=np.array([[0,1,1]],dtype=bool);c=np.array([[1,1,1]],dtype=bool)
  self.assertEqual(matching([a,b],[c]),1)
 def test_augmenting_path_recovers_both(self):
  a=np.array([[1,1,1,1,0]],dtype=bool);b=np.array([[1,1,1,0,1]],dtype=bool)
  both=a.copy();only_a=np.array([[0,1,1,1,0]],dtype=bool)
  self.assertEqual(matching([a,b],[both,only_a],.5),2)
 def test_empty(self):
  self.assertEqual(matching([],[]),0)
if __name__=='__main__':unittest.main()
