public void AddTest1() { DPoint[] points = createPoints(); Differentiator target = new Differentiator(points); target.Add(2, -2); target.Add(5, 31); target.Add(10, 166); Assert.AreEqual(points.Length + 3, target.Points.Length); }
public void SampleSize() { Differentiator target = new Differentiator(); target.SampleSize = 9; //y=2x+1 target.Add(new DPoint(0, 1)); target.Add(new DPoint(1, 3)); target.Add(new DPoint(2, 5)); DPoint[] diffPoints = target.Differentiate(); Assert.AreEqual(3, diffPoints.Length); //expect best line fit, which has gadient of 2 Assert.AreEqual(2, diffPoints[0].Y); Assert.AreEqual(2, diffPoints[1].Y); Assert.AreEqual(2, diffPoints[2].Y); }
public void AddTest2() { Differentiator target = new Differentiator(); //y = 2xx +3x + 4 //y' = 4x +3 target.Add(new DPoint(0, 4)); target.Add(new DPoint(1, 9)); target.Add(new DPoint(2, 18)); DPoint[] points = target.Points; Assert.AreEqual(3, points.Length); Assert.AreEqual(0, points[0].X); Assert.AreEqual(4, points[0].Y); Assert.AreEqual(1, points[1].X); Assert.AreEqual(9, points[1].Y); Assert.AreEqual(2, points[2].X); Assert.AreEqual(18, points[2].Y); }
public void AddTest3() { Differentiator target = new Differentiator(); List <Measurement> list = new List <Measurement>(); list.Add(new Measurement(2, -2)); list.Add(new Measurement(5, 31)); list.Add(new Measurement(10, 166)); target.Add(list, "Wavelength", "Transmittance"); DPoint[] points = target.Points; Assert.AreEqual(3, points.Length); Assert.AreEqual(2, points[0].X); Assert.AreEqual(-2, points[0].Y); Assert.AreEqual(5, points[1].X); Assert.AreEqual(31, points[1].Y); Assert.AreEqual(10, points[2].X); Assert.AreEqual(166, points[2].Y); }
public void AddTest3() { Differentiator target = new Differentiator(); List<Measurement> list = new List<Measurement>(); list.Add(new Measurement(2, -2)); list.Add(new Measurement(5, 31)); list.Add(new Measurement(10, 166)); target.Add(list, "Wavelength", "Transmittance"); DPoint[] points = target.Points; Assert.AreEqual(3, points.Length); Assert.AreEqual(2, points[0].X); Assert.AreEqual(-2, points[0].Y); Assert.AreEqual(5, points[1].X); Assert.AreEqual(31, points[1].Y); Assert.AreEqual(10, points[2].X); Assert.AreEqual(166, points[2].Y); }
public void AddTest1() { DPoint[] points = createPoints(); Differentiator target = new Differentiator(points); target.Add(2, -2); target.Add(5, 31); target.Add(10, 166); Assert.AreEqual(points.Length+3, target.Points.Length); }