public void Skalar_v1_and_v1_returnNorm() { //настроить входные параметры int n = 10; MyMathLib.Vector v = MyMathLib.Vector.RandomVector(n); double expect = v.Norm; double EPS = 0.0000001d; //запустить код double actual = Math.Sqrt(v * v); //проверить на корректность Assert.AreEqual(expect, actual, EPS, "Скалярное произведение должно выраждаться в норму, но нет"); }
public void Skalar_1_and_2_return20() { //настроить входные параметры int n = 10; MyMathLib.Vector v = MyMathLib.Vector.GetConstVector(1d, n); MyMathLib.Vector w = MyMathLib.Vector.GetConstVector(2d, n); double expect = 20d; double EPS = 0.000000001d; //запустить код double actual = w * v; //проверить на корректность Assert.AreEqual(expect, actual, EPS, "Скалярное произведение должно работать, но нет"); }
public void CreateNewBasisSplineGrid_CountMustbe11() { //enter data int deg = 4; int GridSize = 7; double a = 0; double b = 1; MyMathLib.Vector knots = MyMathLib.Vector.CreateUniformGrid(GridSize, a, b); int expect = 11; //code MyMathLib.Grid tau = new MyMathLib.Grid(deg, knots, a, b); int actual = tau.Count; Console.WriteLine(tau.ToString()); Console.WriteLine(tau.ToStringOrigin()); //compare Assert.AreEqual(expect, actual, "Неверный расчет сетки для базисного сплайна"); }