Ejemplo n.º 1
0
 def test_clear_3 (self) :
     r = StringIO.StringIO("5 4\n3 2 1 5\n2 2 5 3\n4 1 3\n5 1 1")
     a = [0, 0]
     c = [0]
     b = pfd_initialize(r, a, c)
     matrix = getMatrix()
     self.assert_(b    == True)
     self.assert_(a[0] ==  5)
     self.assert_(a[1] ==  4)
     self.assert_(matrix == [[0, 0, 0, 0, 0],
                             [0, 0, 1, 0, 1],
                             [1, 0, 0, 0, 1],
                             [0, 0, 1, 0, 0],
                             [1, 0, 0, 0, 0]])
     pfd_clear(0)
     matrix = getMatrix()
     self.assert_(matrix == [[0, 0, 0, 0, 0],
                             [0, 0, 1, 0, 1],
                             [0, 0, 0, 0, 1],
                             [0, 0, 1, 0, 0],
                             [0, 0, 0, 0, 0]] )
     pfd_clear(4)
     matrix = getMatrix()
     self.assert_(matrix == [[0, 0, 0, 0, 0],
                             [0, 0, 1, 0, 0],
                             [0, 0, 0, 0, 0],
                             [0, 0, 1, 0, 0],
                             [0, 0, 0, 0, 0]] )
     pfd_clear(2)
     matrix = getMatrix()
     self.assert_(matrix == [[0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0],
                             [0, 0, 0, 0, 0]] )
Ejemplo n.º 2
0
 def test_clear_2 (self) :
     r = StringIO.StringIO("2 1\n1 1 2")
     a = [0, 0]
     c = [0]
     b = pfd_initialize(r, a, c)
     matrix = getMatrix()
     self.assert_(b    == True)
     self.assert_(a[0] ==  2)
     self.assert_(a[1] ==  1)
     self.assert_(matrix == [[0, 1],[0, 0]] )
     pfd_clear(1)
     matrix = getMatrix()
     self.assert_(matrix == [[0, 0],[0, 0]] )
Ejemplo n.º 3
0
 def test_find_first_target_3 (self) :
     r = StringIO.StringIO("2 1\n2 1 1")
     a = [0, 0]
     c = [0]
     b = pfd_initialize(r, a, c)
     matrix = getMatrix()
     pfd_find_first_target()
Ejemplo n.º 4
0
 def test_find_first_target_2  (self) :        
     r = StringIO.StringIO("5 4\n3 2 1 5\n2 2 5 3\n4 1 3\n5 1 1")
     a = [0, 0]
     c = [0]
     b = pfd_initialize(r, a, c)
     matrix = getMatrix()
     pfd_find_first_target()
Ejemplo n.º 5
0
 def test_initialize_3 (self) :
     r = StringIO.StringIO("2 1\n2 1 1")
     a = [0, 0]
     c = [0]
     b = pfd_initialize(r, a, c)
     matrix = getMatrix()
     self.assert_(b    == True)
     self.assert_(a[0] ==  2)
     self.assert_(a[1] ==  1)
     self.assert_(matrix == [[0, 0],[1, 0]] )