public void Parse_OnlyFirstAndSecondCoefficients() { //arrange string equation = "3x^2 + 4x"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(new double[] { 3, 4, 0 }, coefficients); }
public void Parse_ThreeUnitCoefficients() { //arrange string equation = "x^2 + x - 1"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(new double[] { 1, 1, -1 }, coefficients); }
public void Parse_ThreePositiveIntegerCoefficients() { //arrange string equation = "2x^2 + 4x + 8"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(2, coefficients[0]); Assert.AreEqual(4, coefficients[1]); Assert.AreEqual(8, coefficients[2]); }
public void Parse_ThreeBigCoefficients() { //arrange string equation = "-256000x^2 + 1281024.89000014x + 999999999.999999"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(-256000, coefficients[0]); Assert.AreEqual(1281024.89000014, coefficients[1]); Assert.AreEqual(999999999.999999, coefficients[2]); }
public void Parse_ThreeDoubleCoefficients() { //arrange string equation = "-6,2x^2 - 10,14x + 20,256"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(-6.2, coefficients[0]); Assert.AreEqual(-10.14, coefficients[1]); Assert.AreEqual(20.256, coefficients[2]); }
public void Parse_ThreeNegativeIntegerCoefficients() { //arrange string equation = "-6x^2 - 10x - 20"; EquationSolver equationSolver = new EquationSolver(); //act double[] coefficients = equationSolver.Parse(equation); //assert Assert.AreEqual(-6, coefficients[0]); Assert.AreEqual(-10, coefficients[1]); Assert.AreEqual(-20, coefficients[2]); }