public void solveTest2()
        {
            CalcPolynomial polynomial = new CalcPolynomial();

            double[] a             = { 1, 2, 3, 4 };
            String[] expectedValue = { "2", "-2" };
            String[] actualValue   = polynomial.solve(a);
            Assert.AreNotEqual(expectedValue, actualValue);
        }
        public void solveTest()
        {
            CalcPolynomial polynomial = new CalcPolynomial();

            double[] a             = { 0, -12, 0, 3 };
            String[] expectedValue = { "2", "-2" };
            String[] actualValue   = polynomial.solve(a);
            Assert.AreEqual(expectedValue, actualValue);
        }
Esempio n. 3
0
        private void btmPolX_Click(object sender, EventArgs e)
        {
            int txtno = Int32.Parse(comboBox1.Text);

            double[] inputArr = new double[txtno + 1];
            for (int i = 0; i <= txtno; i++)
            {
                inputArr[i] = double.Parse(((TextBox)tabPage3.Controls["TextBox" + i.ToString()]).Text);
            }
            String[] answers = Polynomial.solve(inputArr);
            if (answers.Length == 1)
            {
                lblPolX.Text = answers[0];
            }
            else if (answers.Length == 2)
            {
                lblPolX.Text = answers[0] + " or " + answers[1];
            }
            else
            {
                lblPolX.Text = "No Solution";
            }
        }