import unittest

from src.Board.board import Board

class Board_Tester(unittest.TestCase):
    def setUp(self) -> None:
        self.board=Board()
        return super().setUp()
    def tearDown(self) -> None:
        self.board=None
        return super().tearDown()

    def test_place(self):
        self.board.reset()
        for i in range(6):
            self.board.place(0,1)
            self.assertEqual(self.board.check_cell(i,0),1)
        self.assertRaises(Exception,self.board.place,0,1)
    def test_is_full(self):
        self.board.reset()
        for i in range(7):
            for j in range(6):
                self.assertFalse(self.board.is_full())
                self.board.place(i,1)
        self.assertTrue(self.board.is_full())
    def test_reset(self):
        self.board.reset()
        self.board.place(0,1)
        self.board.reset()
        self.assertEqual(self.board.check_cell(0,0),None)
    def test_get_board(self):
        self.board.reset()
        for i in range(7):
            for j in range(6):
                self.board.place(i,1)
        board_state=self.board.get_board()
        for i in range(7):
            for j in range(6):
                self.assertEqual(board_state[i][j],1)
    def test_check_cell(self):
        self.board.reset()
        for i in range(7):
            for j in range(6):
                self.board.place(i,1)
        for i in range(7):
            for j in range(6):
                self.assertEqual(self.board.check_cell(j,i),1)
    

