public void CheckSPolynomSum2() { SPolynom poly1 = new SPolynom(new double[] { 25, -4, 44, 0 }); SPolynom poly2 = new SPolynom(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }); SPolynom result = poly1 + poly2; SPolynom expected = new SPolynom(new double[] { 1, 2, 3, 4, 30, 2, 51, 8 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomSum3() { SPolynom poly1 = new SPolynom(new double[] { 25, 10 }, new int[] { 50, 25 }); SPolynom poly2 = new SPolynom(new double[] { 55, 55 }, new int[] { 40, 20 }); SPolynom result = poly1 + poly2; SPolynom expected = new SPolynom(new double[] { 25, 55, 10, 55 }, new int[] { 50, 40, 25, 20 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomDiv1() { SPolynom poly1 = new SPolynom(new double[] { 2, -4, 4, 4 }); SPolynom poly2 = new SPolynom(new double[] { 4, 4, 4, 4, 22, 4, 44, 4 }); SPolynom result = poly2 / poly1; SPolynom expected = new SPolynom(new double[] { 4, 4, 4, 4, 11, -1, 11, 1 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomMult() { SPolynom poly1 = new SPolynom(new double[] { 25, -4, 4, 0 }); SPolynom poly2 = new SPolynom(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }); SPolynom result = poly2 * poly1; SPolynom expected = new SPolynom(new double[] { 1, 2, 3, 4, 125, -24, 28, 0 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomSub3() { SPolynom poly1 = new SPolynom(new double[] { 25, -4, 44, 0 }); SPolynom poly2 = new SPolynom(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }); SPolynom result = poly2 - poly1; SPolynom expected = new SPolynom(new double[] { 1, 2, 3, 4, -20, 10, -37, 8 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomSub2() { SPolynom poly1 = new SPolynom(new double[] { 25, -4, 44, 0 }); SPolynom poly2 = new SPolynom(new double[] { 1, 2, 3, 4, 5, 6, 7, 8 }); SPolynom result = poly1 - poly2; SPolynom expected = new SPolynom(new double[] { -1, -2, -3, -4, 20, -10, 37, -8 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomSub1() { SPolynom poly1 = new SPolynom(new double[] { 25, -4, 44, 0 }); SPolynom poly2 = new SPolynom(new double[] { 25, -4, 44, 0 }); SPolynom result = poly1 - poly2; SPolynom expected = new SPolynom(new double[] { 0 }); Assert.AreEqual(expected, result); }
public void CheckSPolynomDiv2() { SPolynom poly1 = new SPolynom(new double[] { 2, -4, 0, 4 }); SPolynom poly2 = new SPolynom(new double[] { 4, 4, 4, 4, 22, 4, 44, 4 }); Assert.Throws <DivideByZeroException>( () => { var res = poly2 / poly1; }); }
public void CheckSPolynomDiv3() { SPolynom poly1 = new SPolynom(new double[] { 7, 0, 0, 0, 0, 12 }); var str = poly1.ToString(); }