public void Index()//индексация ур-й { SystemOfLinearEquation s = new SystemOfLinearEquation(3); s.Add(new LinearEquation("1,2,3,4")); s.Add(new LinearEquation("5,6,7,8")); s.Add(new LinearEquation("10,11,12,13")); Assert.AreEqual(new LinearEquation("10,11,12,13"), s[2]); }
public void CorrectIndexing() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("2,-4,9,28")); s.Add(new LinearEquation("7,3,-6,-1")); s.Add(new LinearEquation("7,9,-9,5")); Assert.AreEqual(new LinearEquation("7,3,-6,-1"), s[1]); }
public void FailIndex2()//Индексация { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1,-2,4,3")); s.Add(new LinearEquation("-4,5,7,3")); s.Add(new LinearEquation("-3,3,-7,6")); Assert.Equals(typeof(IndexOutOfRangeException), s[5]); }
public void FailWithIndexing2() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1,-2,1,0")); s.Add(new LinearEquation("2,2,-1,3")); s.Add(new LinearEquation("4,-1,1,5")); Assert.Equals(typeof(IndexOutOfRangeException), s[-5]); }
public void CorrectIndexLine() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1,-2,1,0")); s.Add(new LinearEquation("2,2,-1,3")); s.Add(new LinearEquation("4,-1,1,5")); Assert.AreEqual(new LinearEquation("1,-2,1,0"), s[0]); }
public void FailWithIndexing2() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("2,-4,9,28")); s.Add(new LinearEquation("7,3,-6,-1")); s.Add(new LinearEquation("7,9,-9,5")); Assert.Equals(typeof(IndexOutOfRangeException), s[12]); }
public void CorrectIndexing() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1,2,3,15")); s.Add(new LinearEquation("2,4,3,20")); s.Add(new LinearEquation("5,6,7,33")); Assert.AreEqual(new LinearEquation("2,4,3,20"), s[1]); }
public void CorrectIndexing() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1, -2, 4, 3")); s.Add(new LinearEquation("-2, 5, 7, 3")); s.Add(new LinearEquation("-3, 3, -7, 6")); Assert.AreEqual(new LinearEquation("-3, 3, -7, 6"), s[2]); }
public void FailWithIndexing2() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1,2,3,15")); s.Add(new LinearEquation("2,4,3,20")); s.Add(new LinearEquation("5,6,7,33")); Assert.Equals(typeof(IndexOutOfRangeException), s[12]); }
public void CheckNoSolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("3.0, 2.0,-4.0, 3.0")); s.Add(new LinearEquation("6.0, 4.0, -8.0, 15.0")); s.Add(new LinearEquation("6.0, 4.0, -8.0, 15.0")); s.SteppingUp(); Assert.Equals(typeof(ArgumentException), s.SolveSystem()); }
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 InfSolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("2.0,6.0,-5.0,10.0")); s.Add(new LinearEquation("4.0,12.0,-10.0,20.0")); s.Add(new LinearEquation("4.0,12.0,-10.0,20.0")); s.Shiftg(); Assert.Equals(typeof(ArgumentException), s.System()); }
public void InfinitelyManySolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("2.0, 6.0,-5.0, 10.0")); s.Add(new LinearEquation("4.0, 12.0, -10.0, 20.0")); s.Add(new LinearEquation("4.0, 12.0, -10.0, 20.0")); s.SteppingUp(); Assert.Equals(typeof(ArgumentException), s.SolveSystem()); }
public void InfinitelyManySolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("1, 4,-7, 10")); s.Add(new LinearEquation("-1, 4, 3, -14")); s.Add(new LinearEquation("-1, 4, 3, -14")); s.StepUp(); 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 CheckNoSolutions() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("3, 6, 4, 5")); s.Add(new LinearEquation("5, 10, 8, 7")); s.Add(new LinearEquation("-5, -10, -8, -7")); s.StepUp(); Assert.Equals(typeof(ArgumentException), s.Solve()); }
public void Answer() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("3.0, 2.0,-4.0, 3.0")); s.Add(new LinearEquation("2.0, 3.0, 3.0, 15.0")); s.Add(new LinearEquation("5.0, -3, 1.0, 14.0")); s.Shiftg(); double[] res1 = new double[] { 3, 1, 2 }; double[] res2 = s.System(); bool check = true; for (int i = 0; i < n; i++) { if (Math.Abs(res1[i] - res2[i]) > 1e-9) { check = false; } } Assert.AreEqual(true, check); }
public void CorrectAnswer() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); s.Add(new LinearEquation("3.0, 2.0,-4.0, 3.0")); s.Add(new LinearEquation("2.0, 3.0, 3.0, 15.0")); s.Add(new LinearEquation("5.0, -3, 1.0, 14.0")); s.SteppingUp(); double[] solve1 = new double[] { 3, 1, 2 }; double[] solve2 = s.SolveSystem(); bool check = true; for (int i = 0; i < n; i++) { if (Math.Abs(solve1[i] - solve2[i]) > 1e-9) { check = false; } } Assert.AreEqual(true, check); }
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); }
public void CorrectAnswer() { int n = 3; SystemOfLinearEquation s = new SystemOfLinearEquation(n); 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.StepUp(); double[] solve1 = new double[] { -7, -5, 0 }; double[] solve2 = s.Solve(); bool check = true; for (int i = 0; i < n; i++) { if (Math.Abs(solve1[i] - solve2[i]) > 1e-9) { check = false; } } Assert.AreEqual(true, check); }