package kompleksnaStevila;
import kompleksnaStevila.Complex;
import org.junit.Assert;
import org.junit.Test;
public class ComplexAddTest {
@Test
public void testAdd() {
Complex first = new Complex(-4, 5);
Complex second = new Complex(10, 6);
Complex vsota = first.add(second);
Assert.assertEquals(6, vsota.getRealnoStevilo(), 0.1);
Assert.assertEquals(11, vsota.getImaginarnoStevilo(), 0.1);
// preverimo da se vrednosti v first in second ne spremenita
Assert.assertEquals(-4, first.getRealnoStevilo(), 0.1);
Assert.assertEquals(5, first.getImaginarnoStevilo(), 0.1);
Assert.assertEquals(10, second.getRealnoStevilo(), 0.1);
Assert.assertEquals(6, second.getImaginarnoStevilo(), 0.1);
}
}