public void NoSolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("14,16, 40, 20")); s.Add(new LinearEquation("7, 8, 20, 10")); s.Add(new LinearEquation("0, 0, 0, 0")); s.StepView(); Assert.Equals(typeof(ArgumentException), s.Solve()); }
public void ManySolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("3,7,1,0")); s.Add(new LinearEquation("1,2,3,4")); s.StepView(); Assert.Equals(typeof(ArgumentException), s.Solve()); }
public void Solve()//Решение { const int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(3); s.Add(new LinearEquation("1,-2,4,3")); s.Add(new LinearEquation("-4,5,7,3")); s.Add(new LinearEquation("-3,3,-7,6")); s.StepView(); double[] solve1 = new double[] { -7, -5, 0 }; //правильный ответ double[] solve2 = s.Solve(); //ответ полученный функцией bool check = true; for (int i = 0; i < n; i++) { if (solve1[i] != solve2[i]) { check = false; } } Assert.AreEqual(true, check); }