public void QuadraticEquation_Test() { List <double[]> coefficients = new List <double[]>(); coefficients.Add(new double[] { 2, 0 }); coefficients.Add(new double[] { -0.2, -4 }); coefficients.Add(new double[] { 2.5, -100 }); coefficients.Add(new double[] { 3, -7 }); foreach (double[] pair in coefficients) { double[] zeroes = GeneralMath.QuadraticEquation(pair[0], pair[1]); double mid = (zeroes[0] + zeroes[1]) / 2; double actualZero0 = System.Math.Round(zeroes[0] * zeroes[0] + pair[0] * zeroes[0] + pair[1], 10); double actualZero1 = System.Math.Round(zeroes[1] * zeroes[1] + pair[0] * zeroes[1] + pair[1], 10); double actualmid = System.Math.Round(mid * mid + pair[0] * mid + pair[1], 10); Assert.AreEqual(0, actualZero0); Assert.AreEqual(0, actualZero1); Assert.AreNotEqual(0, mid); } }