test
Class GameTest

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

public class GameTest
extends TestCase

Unit tests for the Game class.


Constructor Summary
GameTest(String name)
           
 
Method Summary
 void checkLegal(Player p1, int t1, Player p2, int t2)
          Initializes in a try block to give a useful error.
 void checkLegalHelper(Game o, Player p1, int t1, Player p2, int t2)
          Makes sure initial values set correctly.
 Game checkSaveLoadGame(String gameFileName)
          Helper method that loads a game from a file, converts it to xml, loads it from xml, converts it back, and then compares it.
 void testLegalValues()
          Tests basic legal constructor values.
 void testLegalValuesLoad()
          Tests that an unplayed loaded game fulfills the same requirements as a regular new game.
 void testLegalValuesSaveLoad()
          Tests that an unplayed loaded game fulfills the same requirements as a regular new game, even after saving and reloading.
 void testSaveLoadAdditionalStateGame()
          Tests loading and saving game with maintains additional state (like whether someone has castled).
 void testSaveLoadDrawGame()
          Tests loading and saving game with passes.
 void testSaveLoadFinishedGame()
          Tests loading and saving finished games, and makes sure they have the correct end state.
 void testSaveLoadIncompleteGame()
          Tests an incomplete game (for completeness of testing output).
 void testSaveLoadPowerups()
          Tests loading and saving game with maintains additional state (like whether someone has castled).
 void testSaveLoadSimpleGame()
          Tests
 void testTimed()
          Tests that time updates correctly, and that an exception is thrown if you move after running out of time.
 void testUntimed()
          Tests that untimed games don't update time, and it returns -1.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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

GameTest

public GameTest(String name)
Method Detail

testLegalValues

public void testLegalValues()
Tests basic legal constructor values.


testLegalValuesLoad

public void testLegalValuesLoad()
Tests that an unplayed loaded game fulfills the same requirements as a regular new game.


testLegalValuesSaveLoad

public void testLegalValuesSaveLoad()
Tests that an unplayed loaded game fulfills the same requirements as a regular new game, even after saving and reloading.


checkLegal

public void checkLegal(Player p1,
                       int t1,
                       Player p2,
                       int t2)
Initializes in a try block to give a useful error.


checkLegalHelper

public void checkLegalHelper(Game o,
                             Player p1,
                             int t1,
                             Player p2,
                             int t2)
Makes sure initial values set correctly.


testSaveLoadSimpleGame

public void testSaveLoadSimpleGame()
Tests


testSaveLoadIncompleteGame

public void testSaveLoadIncompleteGame()
Tests an incomplete game (for completeness of testing output).


testSaveLoadFinishedGame

public void testSaveLoadFinishedGame()
Tests loading and saving finished games, and makes sure they have the correct end state.


testSaveLoadDrawGame

public void testSaveLoadDrawGame()
Tests loading and saving game with passes.


testSaveLoadAdditionalStateGame

public void testSaveLoadAdditionalStateGame()
Tests loading and saving game with maintains additional state (like whether someone has castled).


testSaveLoadPowerups

public void testSaveLoadPowerups()
Tests loading and saving game with maintains additional state (like whether someone has castled).


checkSaveLoadGame

public Game checkSaveLoadGame(String gameFileName)
Helper method that loads a game from a file, converts it to xml, loads it from xml, converts it back, and then compares it. It also returns the game for further processing.


testUntimed

public void testUntimed()
Tests that untimed games don't update time, and it returns -1.


testTimed

public void testTimed()
Tests that time updates correctly, and that an exception is thrown if you move after running out of time.