示例#1
0
 def test_exist__example1(self):
     """
     Example 1:
     Input: board = [["A","B","C","E"],
                     ["S","F","C","S"],
                     ["A","D","E","E"]],
             word = "ABCCED"
     Output: true
     """
     board = [["A", "B", "C", "E"], ["S", "F", "C", "S"],
              ["A", "D", "E", "E"]]
     word = "ABCCED"
     exist = WordSearch().exist(board, word)
     self.assertTrue(exist)
示例#2
0
 def test_exist__example3(self):
     """
     Example 3:
     Input: board = [["A","B","C","E"],
                     ["S","F","C","S"],
                     ["A","D","E","E"]],
             word = "ABCB"
     Output: false
     """
     board = [["A", "B", "C", "E"], ["S", "F", "C", "S"],
              ["A", "D", "E", "E"]]
     word = "ABCB"
     exist = WordSearch().exist(board, word)
     self.assertFalse(exist)
示例#3
0
 def test_exist__board_abce_sfes_adee_word_abceseeefs(self):
     board = [["A", "B", "C", "E"], ["S", "F", "E", "S"],
              ["A", "D", "E", "E"]]
     word = "ABCESEEEFS"
     exist = WordSearch().exist(board, word)
     self.assertTrue(exist)
示例#4
0
 def test_exist__board_ab_cd_word_abcda(self):
     board = [["A", "B"], ["C", "D"]]
     word = "ABDCA"
     exist = WordSearch().exist(board, word)
     self.assertFalse(exist)
示例#5
0
 def test_exist__board_ab_cd_word_abdc(self):
     board = [["A", "B"], ["C", "D"]]
     word = "ABDC"
     exist = WordSearch().exist(board, word)
     self.assertTrue(exist)
示例#6
0
 def test_exist__board_a_b_word_b(self):
     board = [["A"], ["B"]]
     word = "B"
     exist = WordSearch().exist(board, word)
     self.assertTrue(exist)
示例#7
0
 def test_exist__board_aa_bc_word_abca(self):
     board = [["A", "A"], ["B", "C"]]
     word = "ABCA"
     exist = WordSearch().exist(board, word)
     self.assertTrue(exist)