Package kompleksnaStevila

Source Code of kompleksnaStevila.ComplexDoubleConstructorTest

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);
    }
}
TOP

Related Classes of kompleksnaStevila.ComplexDoubleConstructorTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.