def test_isDiagonalWin_Fail(self): """Testing the isDiagonalWin method. We put random Yellow and Red pieces in the board. We expect the method to return False and use the assertTrue method to verify our expectations.""" board6 = [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Y',' ',' ','R','Y','R','Y','Y','Y','R'] result6 = False self.assertTrue(result6 == Win_Logic_Connect4.isDiagonalWin(board6,'Y'))
def test_isDiagonalWin_Passed(self): """Testing the isDiagonalWin method. We put four Red pieces to show the method detects a ascending diagonal win. We expect the method to return True and use the assertEquals method to verify our expectations.""" board5 = [' ',' ',' ',' ',' ',' ',' ','R',' ',' ',' ',' ',' ','R',' ',' ',' ',' ',' ','R',' ',' ','Y','Y','Y','R'] result5 = True self.assertEqual(result5,Win_Logic_Connect4.isDiagonalWin(board5,'R'))
def test_isVericalWin_Passed(self): """Testing the isVerticalWin method. We put four Yellow pieces in the first column of the board list as well as . We expect the method to return True and use the assertEquals method to verify our expectations.""" board3 = [' ',' ',' ',' ',' ',' ','Y',' ',' ',' ',' ','Y',' ',' ',' ',' ','Y',' ',' ',' ',' ','Y','R','R','R',' '] result3 = True self.assertEqual(result3,Win_Logic_Connect4.isVerticalWin(board3,'Y'))
def test_isHorizontalWin_Pass(self): """Testing the isHorizontalWin method. We put four Red pieces in the last row of the board list. We expect the method to return True and use the assertEquals method to verify our expectations.""" board1 = [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Y','Y','Y','R','R','R','R'] result1 = True self.assertEqual(result1,Win_Logic_Connect4.isHorizontalWin(board1,'R'))
def test_isWinner_Fail(self): """Testing the isWinner method. We put random pieces of Red and Yellow. We expect the method to return False, since there is no win detected. We use the assertTrue method to verify our exepctations.""" board8 = [' ',' ',' ',' ',' ',' ','R',' ',' ',' ',' ','Y',' ',' ',' ',' ','R',' ',' ',' ',' ','Y','R','R','Y','Y'] result8 = False self.assertTrue(result8 == Win_Logic_Connect4.isWinner(board8,'R'))
def test_isWinner_Passed(self): """Testing the isWinner method. We put four Red pieces in the board to simulate a diagonal win. We expect the method to return True since the win will be a diagional one. We use the assertEqual method to verify our expectations.""" board7 = [' ',' ',' ',' ',' ',' ',' ','R',' ',' ',' ',' ',' ','R',' ',' ',' ',' ',' ','R',' ',' ','Y','Y','Y','R'] result7 = True self.assertEqual(result7,Win_Logic_Connect4.isWinner(board7,'R'))