public void TestFindFarthestInOnePoint() { Point point = new Point(100, 100); FindPairResult result = PointsDistances.FindFarthestPair(new[] { point }); Assert.That(result.Point1, Is.EqualTo(point)); Assert.That(result.Point2, Is.EqualTo(point)); Assert.That(result.Distance, Is.EqualTo(0.0)); }
public void TestFindFarthestInTenPoints() { List <Point> points = Enumerable.Range(0, 10) .Select(a => new Point(-1 * a * a, -1 * a * a)) .ToList(); var expectedResult = new[] { points.First(), points.Last() }; FindPairResult result = PointsDistances.FindFarthestPair(points); CollectionAssert.AreEquivalent(expectedResult, new[] { result.Point1, result.Point2 }); }
public void TestFindFarthestInThreePoints() { Point point1 = new Point(10, 0); Point point2 = new Point(20, 0); Point point3 = new Point(100, 100); FindPairResult result = PointsDistances.FindFarthestPair(new[] { point1, point2, point3 }); Assert.That(result.Point1, Is.EqualTo(point1)); Assert.That(result.Point2, Is.EqualTo(point3)); }
public void TestFindFarthestInTwoPints() { Point point1 = new Point(10, 0); Point point2 = new Point(20, 0); FindPairResult result = PointsDistances.FindFarthestPair(new[] { point1, point2 }); Assert.That(result.Point1, Is.EqualTo(point1)); Assert.That(result.Point2, Is.EqualTo(point2)); Assert.That(result.Distance, Is.EqualTo(10.0)); }
public void TestFindFarthestInEmptyList() { PointsDistances.FindFarthestPair(new Point[0]); }
public void TestFindFarthestInNullList() { PointsDistances.FindFarthestPair(null); }