public void PIApproximator_AddEmptyPoints_ShouldThrow() { Point[] randCollection = new Point[] { }; PIApproximator pia = new PIApproximator(randCollection); Assert.Throws <Exception>(() => pia.Approximate()); }
public void PIApproximator_ApproximateFromAHundredPoints_LateAssignment() { PIApproximator pia = new PIApproximator(); List <Point> points = pia.GeneratePoints(10) as List <Point>; pia.AddPoints(points); double piApproximation = pia.Approximate(); }
public void PIApproximator_AddTenPoints_ShouldNotThrow() { List <Point> randCollection = new List <Point>(); for (int i = 0; i < 10; i++) { randCollection.Add(Point.NewPoint()); } PIApproximator pia = new PIApproximator(randCollection.ToArray()); pia.Approximate(); }
public void PIApproximator_Approximate_ApproximationOver2() { List <Point> randCollection = new List <Point>(); for (int i = 0; i < 10000000; i++) { randCollection.Add(Point.NewPoint()); } PIApproximator pia = new PIApproximator(randCollection.ToArray()); double piApprox = pia.Approximate(); Assert.True(piApprox > 2); }
public void PIApproximator_Approximate_ApproximationAround3dot14() { List <Point> randCollection = new List <Point>(); for (long i = 0; i < 10000000; i++) { randCollection.Add(Point.NewPoint()); } PIApproximator pia = new PIApproximator(randCollection.ToArray()); double piApprox = pia.Approximate(); // approximation around Math.PI Assert.True(piApprox >= (Math.PI - (Math.PI * 0.1))); Assert.True(piApprox <= (Math.PI + (Math.PI * 0.1))); }