ps0.test
Class FibonacciTest

java.lang.Object
  extended by TestCase
      extended by ps0.test.FibonacciTest

public class FibonacciTest
extends TestCase

FibonacciTest is a glassbox test of the Fibonacci class. Recall that the Fibonacci sequence is a recursive sequence where the first two terms of the sequence are 1 and all subsequent terms are the sum of the previous two terms. Thus, the Fibonacci sequence starts out as 1, 1, 2, 3, 5, 8, 13... The first 1 in the sequence is considered the "0th" term, so the indices that ps0.Fibonacci uses are 0-based.

See Also:
Fibonacci

Constructor Summary
FibonacciTest()
           
 
Method Summary
protected  void setUp()
           
 void testBaseCase()
          Tests to see that Fibonacci returns the correct value for the base cases, n=0 and n=1
 void testInductiveCase()
          Tests inductive cases of the Fibonacci sequence
 void testThrowsIllegalArgumentException()
          Tests to see that Fibonacci throws an IllegalArgumentException for a negative number but not for zero or for a positive number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FibonacciTest

public FibonacciTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Throws:
Exception

testThrowsIllegalArgumentException

public void testThrowsIllegalArgumentException()
Tests to see that Fibonacci throws an IllegalArgumentException for a negative number but not for zero or for a positive number.


testBaseCase

public void testBaseCase()
Tests to see that Fibonacci returns the correct value for the base cases, n=0 and n=1


testInductiveCase

public void testInductiveCase()
Tests inductive cases of the Fibonacci sequence