def test_pos_attacked_horizontally(self): board = [[0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]] self.assertTrue(is_attacked(x=2, y=2, board=board))
def test_empty_board(self): board = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] self.assertFalse(is_attacked(x=0, y=0, board=board))
def test_pos_attacked_on_the_first_diagonal(self): board = [[0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] self.assertTrue(is_attacked(x=3, y=0, board=board))
def test_pos_attacked_on_the_second_diagonal(self): board = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0]] self.assertTrue(is_attacked(x=0, y=1, board=board))
def test_pos_attacked_vertically(self): board = [[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] self.assertTrue(is_attacked(x=3, y=1, board=board))