ctf.evaluation.simulator.setup
Class PlaceTrees

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by ctf.evaluation.TestCase
              extended by ctf.evaluation.simulator.setup.PlaceTrees
All Implemented Interfaces:
junit.framework.Test

public class PlaceTrees
extends TestCase

Tests the 'PlaceTrees' state


Constructor Summary
PlaceTrees()
           
 
Method Summary
protected  void place(Connection connection, double x, double y)
          Place a tree at a specific (x,y) location
protected  void place(Connection connection, Point point)
          Place a tree at a specific point
protected  void placeNormal(Connection connection, Side side)
          Place one side's trees in the standard locations
 void setUp()
          Get into the PlaceTrees state
 void tearDown()
          Tear down after a test
 void testBottomEdgeOfTheField()
          Trees may not be placed within 1m of the edge of the field
 void testCentreLine()
          Trees may not be placed within 1m of the centre line
 void testCentreToCentreDistance()
          Trees may not be placed within 1m of the centre line
 void testJail()
          A tree may not be placed with 1m of a jail
 void testLeftEdgeOfTheField()
          Trees may not be placed within 1m of the edge of the field
 void testNormalPlacement()
          Trees are placed in default locations
 void testPartialPlacement()
          After some of a team's trees have been placed, the other team sends a getTrees query.
 void testRightEdgeOfTheField()
          Trees may not be placed within 1m of the edge of the field
 void testTopEdgeOfTheField()
          Trees may not be placed within 1m of the edge of the field
 void testTreePlayerDistance()
          Trees may not be placed within 1.2m of a player's starting position
 void testTreesOnEnemySide()
          A team may not place a tree on the opposing side of the field
 
Methods inherited from class ctf.evaluation.TestCase
assertClose, assertClose, assertClose, assertClose, assertClose, assertClose, assertClose, assertCloseAbsolute, sleep
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlaceTrees

public PlaceTrees()
Method Detail

setUp

public void setUp()
           throws java.io.IOException,
                  NetworkException,
                  ProtocolError
Get into the PlaceTrees state

Overrides:
setUp in class TestCase
Throws:
java.io.IOException
NetworkException
ProtocolError

tearDown

public void tearDown()
Tear down after a test

Overrides:
tearDown in class TestCase

testNormalPlacement

public void testNormalPlacement()
                         throws java.io.IOException,
                                NetworkException,
                                ProtocolError
Trees are placed in default locations

Throws:
java.io.IOException
NetworkException
ProtocolError

testPartialPlacement

public void testPartialPlacement()
                          throws java.io.IOException,
                                 NetworkException,
                                 ProtocolError
After some of a team's trees have been placed, the other team sends a getTrees query. Unplaced trees should be shown as having a location (0.0,0.0).

Throws:
java.io.IOException
NetworkException
ProtocolError

testLeftEdgeOfTheField

public void testLeftEdgeOfTheField()
                            throws java.io.IOException,
                                   NetworkException,
                                   ProtocolError
Trees may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testBottomEdgeOfTheField

public void testBottomEdgeOfTheField()
                              throws java.io.IOException,
                                     NetworkException,
                                     ProtocolError
Trees may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testTopEdgeOfTheField

public void testTopEdgeOfTheField()
                           throws java.io.IOException,
                                  NetworkException,
                                  ProtocolError
Trees may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testRightEdgeOfTheField

public void testRightEdgeOfTheField()
                             throws java.io.IOException,
                                    NetworkException,
                                    ProtocolError
Trees may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testCentreLine

public void testCentreLine()
                    throws java.io.IOException,
                           NetworkException,
                           ProtocolError
Trees may not be placed within 1m of the centre line

Throws:
java.io.IOException
NetworkException
ProtocolError

testCentreToCentreDistance

public void testCentreToCentreDistance()
                                throws java.io.IOException,
                                       NetworkException,
                                       ProtocolError
Trees may not be placed within 1m of the centre line

Throws:
java.io.IOException
NetworkException
ProtocolError

testTreePlayerDistance

public void testTreePlayerDistance()
                            throws java.io.IOException,
                                   NetworkException,
                                   ProtocolError
Trees may not be placed within 1.2m of a player's starting position

Throws:
java.io.IOException
NetworkException
ProtocolError

testTreesOnEnemySide

public void testTreesOnEnemySide()
                          throws java.io.IOException,
                                 NetworkException,
                                 ProtocolError
A team may not place a tree on the opposing side of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testJail

public void testJail()
              throws java.io.IOException,
                     NetworkException,
                     ProtocolError
A tree may not be placed with 1m of a jail

Throws:
java.io.IOException
NetworkException
ProtocolError

place

protected void place(Connection connection,
                     Point point)
              throws java.io.IOException,
                     NetworkException
Place a tree at a specific point

Throws:
java.io.IOException
NetworkException

place

protected void place(Connection connection,
                     double x,
                     double y)
              throws java.io.IOException,
                     NetworkException
Place a tree at a specific (x,y) location

Throws:
java.io.IOException
NetworkException

placeNormal

protected void placeNormal(Connection connection,
                           Side side)
                    throws java.io.IOException,
                           NetworkException
Place one side's trees in the standard locations

Throws:
java.io.IOException
NetworkException