test
Class GameStateTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by test.GameStateTest
All Implemented Interfaces:
Test

public class GameStateTest
extends TestCase

Unit tests for the GameState class.


Constructor Summary
GameStateTest(String name)
           
 
Method Summary
protected  void setUp()
           
 void testCastle()
          Check that you can castle when not passing through check, only if neither rook nor king has moved before.
 void testEnPassant()
          Test that en passant works, but expires.
 void testForcing()
          Test that the ability to capture forces the move.
 void testGetMoveNum()
          Check that the move number increases as desired, and decreases when reverting a move.
 void testInvalidState()
          Check that the GameState can find when the wrong player is in check.
 void testIsLegal()
          Test that isLegal works.
 void testLegalMoves()
          Test that legalMoves doesn't modify the state, and is correct for an easy case.
 void testNoMoves()
          Test when you are forced to pass.
 void testPowerups()
          Test that pawns promote at the end.
 void testQueening()
          Test that pawns promote at the end.
 void testToString()
          Test tostring after a move
 void testWinner()
          Test the game's detection of the winner, in the various cases.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameStateTest

public GameStateTest(String name)
Method Detail

setUp

protected void setUp()
Overrides:
setUp in class TestCase

testGetMoveNum

public void testGetMoveNum()
Check that the move number increases as desired, and decreases when reverting a move.


testInvalidState

public void testInvalidState()
Check that the GameState can find when the wrong player is in check.


testLegalMoves

public void testLegalMoves()
Test that legalMoves doesn't modify the state, and is correct for an easy case.


testToString

public void testToString()
Test tostring after a move


testCastle

public void testCastle()
Check that you can castle when not passing through check, only if neither rook nor king has moved before.


testForcing

public void testForcing()
Test that the ability to capture forces the move.


testEnPassant

public void testEnPassant()
Test that en passant works, but expires.


testQueening

public void testQueening()
Test that pawns promote at the end.


testIsLegal

public void testIsLegal()
Test that isLegal works.


testNoMoves

public void testNoMoves()
Test when you are forced to pass.


testWinner

public void testWinner()
Test the game's detection of the winner, in the various cases.


testPowerups

public void testPowerups()
Test that pawns promote at the end.