FileDocCategorySizeDatePackage
ComplexTest.javaAPI DocExample713Thu May 13 18:29:00 BST 2004None

ComplexTest

public class ComplexTest extends TestCase
Test cases for Complex
author
ian

Fields Summary
Constructors Summary
Methods Summary
public voidtestAdd()

		Complex a = new Complex(3,-1);
		Complex b = new Complex(1, 5);
		Complex sum = Complex.add(a, b);
		assertEquals("add test", new Complex(4, 4), sum);
	
public voidtestEquals()

		Complex c = new Complex(Math.PI, -Math.PI);
		assertEquals("equality test", c, c);
	
public voidtestMultiply()

		Complex c = new Complex(3,  5);
		Complex d = new Complex(2, -2);
		Complex m = new Complex(16.0, 4.0);
	
public voidtestToString()

		assertEquals("toString Test", "3.4-5.6i", 
				new Complex(3.4, -5.6).toString());