def test_board_with_no_lines(self): board1 = visual_to_board(""" * * * * * * * * * """) self.assertEqual(squares(board1), {1: 0, 2: 0}) board2 = visual_to_board(""" * """) self.assertEqual(squares(board2), {})
def test_board_with_no_lines_forming_squares(self): board1 = visual_to_board(""" *-* | * * """) self.assertEqual(squares(board1), {1: 0}) board2 = visual_to_board(""" *-*-*-* | | * * *-* | | * *-*-* | | | * * *-* """) self.assertEqual(squares(board2), {1: 0, 2: 0, 3: 0})
def test_identifies_squares_of_size_1(self): board1 = visual_to_board(""" *-*-* | *-*-* | | | * *-* """) self.assertEqual(squares(board1), {1: 1, 2: 0}) board2 = visual_to_board(""" * * * * | | | * *-*-* | | | *-*-*-* | | | *-* * * """) self.assertEqual(squares(board2), {1: 3, 2: 0, 3: 0})
def test_idenfities_full_board_squares(self): board1 = visual_to_board(""" *-*-*-* | | * * * * | | * * * * | | *-*-*-* """) self.assertEqual(squares(board1), {1: 0, 2: 0, 3: 1}) board2 = visual_to_board(""" *-*-* | | * * * | | *-*-* """) self.assertEqual(squares(board2), {1: 0, 2: 1})