@Test
public void testComplexConstructorString() {
String a = "-3.0";
String b = "4.0";
String complex = a + "-" + b + "i";
Complex c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(Double.parseDouble("-" + b),
c.getImaginarnoStevilo(), 0.1);
a = "3.0";
b = "4.0";
complex = a + "-" + b + "i";
c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(Double.parseDouble("-" + b),
c.getImaginarnoStevilo(), 0.1);
a = "3.0";
b = "4.0";
complex = a + "+" + b + "i";
c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(Double.parseDouble(b), c.getImaginarnoStevilo(),
0.1);
a = "3.0";
b = "";
complex = a + "-" + b + "i";
c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(-1.0, c.getImaginarnoStevilo(), 0.1);
b = "4.0";
complex = b + "i";
c = new Complex(complex);
Assert.assertEquals(0.0, c.getRealnoStevilo(), 0.1);
Assert.assertEquals(Double.parseDouble(b), c.getImaginarnoStevilo(),
0.1);
a = "3.0";
b = "";
complex = a + "+i";
c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(1.0, c.getImaginarnoStevilo(), 0.1);
complex = "i";
c = new Complex(complex);
Assert.assertEquals(0.0, c.getRealnoStevilo(), 0.1);
Assert.assertEquals(1.0, c.getImaginarnoStevilo(), 0.1);
a = "3.0";
complex = a;
c = new Complex(complex);
Assert.assertEquals(Double.parseDouble(a), c.getRealnoStevilo(), 0.1);
Assert.assertEquals(0.0, c.getImaginarnoStevilo(), 0.1);
}