Example #1
0
        public void EqualsTests(bool expected, double[] a1, double[] a2)
        {
            PolynomialLib.Polynomial polynomial1 = new PolynomialLib.Polynomial(a1);
            PolynomialLib.Polynomial polynomial2 = new PolynomialLib.Polynomial(a2);

            Assert.AreEqual(expected, polynomial1.Equals(polynomial2));
        }
Example #2
0
        public void DoestNotEqualOperatorTests(bool expected, double[] a1, double[] a2)
        {
            PolynomialLib.Polynomial polynomial1 = new PolynomialLib.Polynomial(a1);
            PolynomialLib.Polynomial polynomial2 = new PolynomialLib.Polynomial(a2);

            Assert.AreEqual(expected, polynomial1 != polynomial2);
        }
Example #3
0
        public void PlusOperatorTests(double[] expected, double[] a1, double[] a2)
        {
            PolynomialLib.Polynomial polynomial1 = new PolynomialLib.Polynomial(a1);
            PolynomialLib.Polynomial polynomial2 = new PolynomialLib.Polynomial(a2);
            PolynomialLib.Polynomial polynomial3 = polynomial1 + polynomial2;
            PolynomialLib.Polynomial expectedP   = new PolynomialLib.Polynomial(expected);

            Assert.AreEqual(expectedP, polynomial3);
        }
Example #4
0
        public void MultiplyOperatorTests(double[] expected, double[] a1, double[] a2)
        {
            PolynomialLib.Polynomial polynomial1 = new PolynomialLib.Polynomial(a1);
            PolynomialLib.Polynomial polynomial2 = new PolynomialLib.Polynomial(a2);
            PolynomialLib.Polynomial polynomial3 = polynomial1 * polynomial2;

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], polynomial3.PolynomialValue[i]);
            }
        }
Example #5
0
        public void ToStringTests(string expected, double[] a1)
        {
            PolynomialLib.Polynomial polynomial1 = new PolynomialLib.Polynomial(a1);

            Assert.AreEqual(expected, polynomial1.ToString());
        }