ctf.evaluation
Class TestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by ctf.evaluation.TestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
PlaceFlag, PlaceTrees, PlayerPositions, PlayTestCase, RequestSide, Start, STEALTest, Version

public class TestCase
extends junit.framework.TestCase

A JUnit test case, with a couple of extra methods. Normally, I wouldn't use inheritance for this sort of thing. Inheritance, however, is exactly how the JUnit people do it, so I'll follow their convention.


Constructor Summary
TestCase()
           
 
Method Summary
static void assertClose(double expected, double actual)
          Ensure that two floats are "close" to each other (using the default tolerance).
static void assertClose(double expected, double actual, double tolerance)
          Ensure that two floats are "close" to each other.
static void assertClose(Point expected, Point actual)
          Ensure that two points are "close" to each other.
static void assertClose(java.lang.String message, double expected, double actual)
          Ensure that two floats are "close" to each other (using the default tolerance).
static void assertClose(java.lang.String message, double expected, double actual, double tolerance)
          Ensure that two floats are within some % tolerance of each other.
static void assertClose(java.lang.String message, Point expected, Point actual)
          Ensure that two points are "close" to each other.
static void assertClose(java.lang.String message, Point expected, Point actual, double tolerance)
          Ensure that two points are "close" to each other.
static void assertCloseAbsolute(java.lang.String message, Point expected, Point actual, double diff)
          Ensure that two points are "close" to each other.
 void setUp()
           
protected  void sleep(int milliseconds)
          Wait for a number of milliseconds (no InterruptedException).
 void tearDown()
           
 
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

TestCase

public TestCase()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

sleep

protected void sleep(int milliseconds)
Wait for a number of milliseconds (no InterruptedException).


assertClose

public static void assertClose(double expected,
                               double actual)
Ensure that two floats are "close" to each other (using the default tolerance).

Parameters:
expected - the expected value
actual - the actual value

assertClose

public static void assertClose(double expected,
                               double actual,
                               double tolerance)
Ensure that two floats are "close" to each other.

Parameters:
expected - the expected value
actual - the actual value
tolerance - how close they should be (e.g. .01 => 1% tol.)

assertClose

public static void assertClose(java.lang.String message,
                               double expected,
                               double actual)
Ensure that two floats are "close" to each other (using the default tolerance).

Parameters:
message - what to say if they're not close enough
expected - the expected value
actual - the actual value

assertClose

public static void assertClose(java.lang.String message,
                               double expected,
                               double actual,
                               double tolerance)
                        throws junit.framework.AssertionFailedError
Ensure that two floats are within some % tolerance of each other.

Parameters:
message - what to say if they're not close enough
expected - the expected value
actual - the actual value
tolerance - how close they should be (e.g. .01 => 1% tol.)
Throws:
junit.framework.AssertionFailedError

assertClose

public static void assertClose(Point expected,
                               Point actual)
Ensure that two points are "close" to each other.

Parameters:
expected - the expected value
actual - the actual value

assertClose

public static void assertClose(java.lang.String message,
                               Point expected,
                               Point actual)
Ensure that two points are "close" to each other.

Parameters:
message - what to say if they're not close enough
expected - the expected value
actual - the actual value

assertClose

public static void assertClose(java.lang.String message,
                               Point expected,
                               Point actual,
                               double tolerance)
Ensure that two points are "close" to each other.

Parameters:
message - what to say if they're not close enough
expected - the expected value
actual - the actual value
tolerance - how close they should be (e.g. .01 => 1% tol.)

assertCloseAbsolute

public static void assertCloseAbsolute(java.lang.String message,
                                       Point expected,
                                       Point actual,
                                       double diff)
Ensure that two points are "close" to each other.

Parameters:
message - what to say if they're not close enough
expected - the expected value
actual - the actual value
diff - maximum difference between values