Ejemplo n.º 1
0
 def test_correct_work(self):
     """Simple test of correct work"""
     matr = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
     test_matr = a.make_border(matr)
     self.assertTrue(test_matr[0][0] != 0)
     self.assertTrue(test_matr[-1][-1] != 0)
     self.assertTrue(test_matr[-1][0] != 0)
     self.assertTrue(test_matr[0][-1] != 0)
Ejemplo n.º 2
0
 def test_not_square(self):
     """Test on rectangle"""
     matr = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
             [0, 0, 0, 0, 0]]
     test_matr = a.make_border(matr)
     self.assertTrue(test_matr[0][0] != 0)
     self.assertTrue(test_matr[-1][-1] != 0)
     self.assertTrue(test_matr[-1][0] != 0)
     self.assertTrue(test_matr[0][-1] != 0)
Ejemplo n.º 3
0
 def test_obst(self):
     """Diagonally move"""
     matr1 = [[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
     self.assertFalse(a.find_way((1, 1), (4, 4), a.make_border(matr1)))
Ejemplo n.º 4
0
 def test_lazytest(self):
     """No moving"""
     matr1 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
     self.assertFalse(a.find_way((0, 0), (0, 0), a.make_border(matr1)))
Ejemplo n.º 5
0
 def test_obstacles(self):
     """No way"""
     matr3 = [[0, 0, 1, 0], [0, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0]]
     self.assertFalse(a.find_way((0, 0), (3, 3), a.make_border(matr3)))
Ejemplo n.º 6
0
 def test_hard_labirinth(self):
     """Hard way"""
     matr2 = [[0, 0, 1, 0, 0], [1, 0, 1, 0, 0], [0, 0, 1, 0, 0],
              [0, 1, 1, 0, 0], [0, 0, 0, 0, 0]]
     self.assertTrue(a.find_way((1, 1), (1, 4), a.make_border(matr2)))
Ejemplo n.º 7
0
 def test_no_obst(self):
     """Easy way"""
     matr1 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
     self.assertTrue(a.find_way((1, 1), (4, 4), a.make_border(matr1)))