package kompleksnaStevila;
import kompleksnaStevila.Complex;
import org.junit.*;
public class ComplexDoubleConstructorTest {
@Test
public void testComplexConstructorReal() {
double napaka = 0.01;
double real = 10.6;
Complex kompleksno = new Complex(real);
Assert.assertEquals(real, kompleksno.getRealnoStevilo(), napaka);
Assert.assertEquals(0.0, kompleksno.getImaginarnoStevilo(), napaka);
}
@Test
public void testComplexConstructorImg() {
double napaka = 0.01;
double real = 10.6;
Complex kompleksno = new Complex(real);
Assert.assertEquals(real, kompleksno.getRealnoStevilo(), napaka);
Assert.assertEquals(0.0, kompleksno.getImaginarnoStevilo(), napaka);
}
@Test
public void testSetMethod() {
Complex kompleksno = new Complex(10);
kompleksno.setImaginarnoStevilo(15);
kompleksno.setRealnoStevilo(-5);
Assert.assertEquals(-5, kompleksno.getRealnoStevilo(), 0.1);
Assert.assertEquals(15, kompleksno.getImaginarnoStevilo(), 0.1);
}
}