# 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
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board
        board.winner = BLACK
        board.nocapture_moves = 80
        board.draw = True

        result = board.get_state()
        self.assertEqual(result['board'], config)
        self.assertEqual(result['who_moves'], BLACK)
        self.assertEqual(result['white_infractions'], 40)
        self.assertEqual(result['black_infractions'], 10)
        self.assertEqual(result['bad_move'], True)
        self.assertEqual(result['enpassant'][0], 3)
        self.assertEqual(result['enpassant'][1], 6)
        self.assertEqual(result['winner'], BLACK)
        self.assertEqual(result['50moves'], True)
        self.assertEqual(result['draw'], True)

    def test_losing_enpassant(self):
        config = 'r......r' + \
                 'pppp.ppp' + \
                 '........' + \
                 '...Pp...' + \
                 '........' + \
                 '........' + \
                 'PPP.PPPP' + \
                 'R......R' 
        board = self.get_board(config)

        board.enpassant = C('e6')
        board.enpassant_piece = board[C('e5')]


# 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_state.py
import unittest
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK, NONE
        from chess.models import Board

        board.winner = BLACK
        board.nocapture_moves = 80
        board.draw = True

        result = board.get_state()
        self.assertEqual(result['board'], config)
        self.assertEqual(result['who_moves'], BLACK)
        self.assertEqual(result['white_infractions'], 40)
        self.assertEqual(result['black_infractions'], 10)
        self.assertEqual(result['bad_move'], True)
        self.assertEqual(result['enpassant'][0], 3)
        self.assertEqual(result['enpassant'][1], 6)
        self.assertEqual(result['winner'], BLACK)
        self.assertEqual(result['50moves'], True)
        self.assertEqual(result['draw'], True)

    def test_losing_enpassant(self):
        config = 'r......r' + \
                 'pppp.ppp' + \
                 '........' + \
                 '...Pp...' + \
                 '........' + \
                 '........' + \
                 'PPP.PPPP' + \
                 'R......R' 
        board = self.get_board(config)

        board.enpassant = C('e6')
        board.enpassant_piece = board[C('e5')]


        board.move(C('e2'), C('e4'))