import unittest

from src.Board.board import Board
from src.AI.ai import AI

class AI_Tester(unittest.TestCase):
    def setUp(self) -> None:
        self.ai=AI()
        self.board=Board()
        return super().setUp()
    def tearDown(self) -> None:
        self.ai=None
        return super().tearDown()
    def test_get_move_random(self):
        self.board.reset()
        for i in range(6):
            self.board.place(0,i%2+1)
            self.board.place(1,i%2+1)
            self.board.place(2,(i+1)%2+1)
            self.board.place(3,(i+1)%2+1)
            self.board.place(5,i%2+1)
            self.board.place(6,i%2+1)
        self.assertEqual(self.ai.get_move(self.board),4)
    def test_get_move_win(self):
        self.board.reset()
        self.board.place(0,2)
        self.board.place(1,2)
        self.board.place(2,2)
        self.assertEqual(self.ai.get_move(self.board),3)
    def test_get_move_block(self):
        self.board.reset()
        self.board.place(0,1)
        self.board.place(1,1)
        self.board.place(2,1)
        self.assertEqual(self.ai.get_move(self.board),3)
