# Path: tests/case_board.py
# class BoardTestCase(unittest.TestCase):
#     def setUp(self):
#         import chess
#         chess.config = {
#             "slot_0_ip": "",
#             "slot_0_port": 50100,
#             "slot_1_ip": "",
#             "slot_1_port": 50200,
#             "update_frequency": 10,
#             "max_move_time": 5.9,
#             "max_infractions": 5
#         }
# 
# Path: tests/helpers.py
# def C(pos):
#     row = int(pos[1]) - 1
#     col = POS[pos[0]]
#     return row, col
# 
# WHITE = 1
# 
# BLACK = -1
# 
# NONE = 0


import unittest
        import chess
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board
        board.win_methods = [stub_win_infraction]
        board.white_infractions = 9
        board.black_infractions = 9

        self.assertEqual(board.winner, NONE)
        self.assertEqual(board.white_infractions, 9)
        board.move(C('e2'), C('a1'))
        self.assertEqual(board.white_infractions, 10)
        self.assertEqual(board.winner, BLACK)

    def test_infraction_whitewin(self):
        config = 'r......r' + \
                 'pppppppp' + \
                 '........' + \
                 '.......R' + \
                 '........' + \
                 '........' + \
                 'PPPPPPPP' + \
                 'R.......' 

        board = self.get_board(config)
        board.win_methods = [stub_win_infraction]
        board.who_moves = BLACK
        board.white_infractions = 9
        board.black_infractions = 9

        self.assertEqual(board.winner, NONE)
        self.assertEqual(board.black_infractions, 9)
        board.move(C('e2'), C('a1'))
        self.assertEqual(board.black_infractions, 10)

# Path: tests/case_board.py
# class BoardTestCase(unittest.TestCase):
#     def setUp(self):
#         import chess
#         chess.config = {
#             "slot_0_ip": "",
#             "slot_0_port": 50100,
#             "slot_1_ip": "",
#             "slot_1_port": 50200,
#             "update_frequency": 10,
#             "max_move_time": 5.9,
#             "max_infractions": 5
#         }
# 
# Path: tests/helpers.py
# def C(pos):
#     row = int(pos[1]) - 1
#     col = POS[pos[0]]
#     return row, col
# 
# WHITE = 1
# 
# BLACK = -1
# 
# NONE = 0


# Path: tests/test_board_win.py
import unittest
        import chess
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board

        board.win_methods = [stub_win_infraction]
        board.white_infractions = 9
        board.black_infractions = 9

        self.assertEqual(board.winner, NONE)
        self.assertEqual(board.white_infractions, 9)
        board.move(C('e2'), C('a1'))
        self.assertEqual(board.white_infractions, 10)
        self.assertEqual(board.winner, BLACK)

    def test_infraction_whitewin(self):
        config = 'r......r' + \
                 'pppppppp' + \
                 '........' + \
                 '.......R' + \
                 '........' + \
                 '........' + \
                 'PPPPPPPP' + \
                 'R.......' 

        board = self.get_board(config)
        board.win_methods = [stub_win_infraction]
        board.who_moves = BLACK
        board.white_infractions = 9
        board.black_infractions = 9

        self.assertEqual(board.winner, NONE)
        self.assertEqual(board.black_infractions, 9)
        board.move(C('e2'), C('a1'))
        self.assertEqual(board.black_infractions, 10)

        self.assertEqual(board.winner, WHITE)