public void Report_ForGivenSetOfRandomSegments_ReturnsTotalLength() { //Arrange SortedSet <Segment> set = GeneratePath(); MinHeap <Point> points = ExtractPoints(set); CleaningAnalyst analyst = new CleaningAnalyst(set, points); //Act int result = analyst.Report(); Assert.AreEqual(9, result); }
public void CheckIntersection_GivenSegmentsHaveFourIntersections_ReturnsFour() { //Arrange SortedSet <Segment> set = GeneratePath(); MinHeap <Point> points = ExtractPoints(set); CleaningAnalyst analyst = new CleaningAnalyst(set, points); Segment a = new Segment(new Point(3, 4), new Point(3, 7), Segment.Position.Vertical); Segment c = new Segment(new Point(3, 1), new Point(3, 7), Segment.Position.Vertical); //Act int result = analyst.CheckIntersection(a, c); Assert.AreEqual(4, result); }
public void Report_AsymptotycPerformanceTest() { //Arrange GenerateData(); MinHeap <Point> points = ExtractPoints(_set); CleaningAnalyst analyst = new CleaningAnalyst(_set, points); NaiveCleaningAnalyst naiveAnalyst = new NaiveCleaningAnalyst(_list); //Act Stopwatch watch = Stopwatch.StartNew(); analyst.Report(); watch.Stop(); Console.WriteLine("Smart analyst finished in: " + watch.ElapsedMilliseconds); watch.Reset(); watch.Start(); naiveAnalyst.Report(); watch.Stop(); Console.WriteLine("Naive analyst finished in: " + watch.ElapsedMilliseconds); }