public void PolynomEqualsTest() { Polynomial a = new Polynomial(new double[] { 1.1, 0, 3.3 }); Polynomial b = new Polynomial(new double[] { 1.1, 0, 3.3 }); bool expected = true; bool actual = a == b; Assert.AreEqual(expected,actual); }
public void PolynomAdditionTest() { Polynomial a = new Polynomial(new double[] { 1.1, 2.2, 3.3, 0, -14.4 }); Polynomial b = new Polynomial(new double[] { 1.1, 2.2, 3.3, 0, -14.4 }); Polynomial expected = new Polynomial(new double[] { 2.2, 4.4, 6.6, 0, -28.8 }); Polynomial actual = a + b; CollectionAssert.AreEqual(expected.Coefficients,actual.Coefficients); }
public void PolynomSubtractionTest() { Polynomial a = new Polynomial(new double[] { 1.1, 2.2, 3.3, 0, -14.4 }); Polynomial b = new Polynomial(new double[] { 1.1, 2.2, 3.3, 0, -14.4 }); Polynomial expected = new Polynomial(new double[] { 0, 0, 0, 0, 0 }); Polynomial actual = a - b; bool result = expected == actual; CollectionAssert.AreEqual(expected.Coefficients, actual.Coefficients); }
public void PolynomMultiplicationTest() { Polynomial a = new Polynomial(new double[] { 1.1, 0, 3.3 }); Polynomial b = new Polynomial(new double[] { 1.1, 0, 3.3 }); Polynomial expected = new Polynomial(new double[] { 1.21, 0, 7.26, 0, 10.89 }); Polynomial actual = a * b; bool isEqual = expected == actual; Assert.AreEqual(true, isEqual); }
public void PolynomWithEmptyArray_ShouldThrowException() { Polynomial a = new Polynomial(new double[] {}); Assert.Fail(); }