def testWalkNoSplit(self): board = Board.create("""\ x 3|2 3|1 x """) graph = BoardGraph() expected_states = set("""\ 3|2 3|1 """.split('---\n')) states = graph.walk(board) self.assertEqual(expected_states, states)
def testWalkNoLoner(self): board = Board.create("""\ x 3 5 x - - x 2 4 x x 3|5 x """) graph = BoardGraph() expected_states = set("""\ 3 5 - - 2 4 3|5 """.split('---\n')) states = graph.walk(board) self.assertEqual(expected_states, states)
def ignoreWalkLast(self): """ Switching to NetworkX broke this. Not really used, so ignore for now. """ board = Board.create("""\ 3 x x - 2 0|2 0|1 x """) graph = BoardGraph() expected_last = """\ 3 0|2 x - 2 x 0|1 """ graph.walk(board) self.assertMultiLineEqual(expected_last, graph.last)
def testWalkDown(self): board = Board.create("""\ x 3 x x x - x 2 0|2 x x 0|1 x x """) graph = BoardGraph() expected_states = set("""\ 3 x x - 2 0|2 0|1 x --- 3 x x - 2 0|2 x 0|1 --- 3 x x x - 2 0|2 x x x 0|1 --- 3 0|2 - 2 0|1 --- 3 0|2 x - 2 x 0|1 """.split('---\n')) states = graph.walk(board) self.assertEqual(expected_states, states)
def testWalkLeft(self): board = Board.create("""\ x 0|2 0|1 x """) graph = BoardGraph() expected_states = set("""\ 0|2 0|1 --- 0|2 x x 0|1 --- x 0|2 0|1 x """.split('---\n')) states = graph.walk(board) self.assertEqual(expected_states, states)