Skip to content

Commit ab59a23

Browse files
committed
test: fix testcases to use expected points
1 parent 5c3cd70 commit ab59a23

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/Spatial.Tests/Euclidean/Circle2DTests.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,20 @@ public void CircleFromThreePointsArgumentException()
6060
Assert.Throws<ArgumentException>(() => { Circle2D.FromPoints(p1, p2, p3); });
6161
}
6262

63-
[TestCase("0,0", 1, "-10,+10", "+10,+10", 0)]
64-
[TestCase("0,0", 1, "-10,+1", "+10,+1", 1)]
65-
[TestCase("0,0", 1, "-10,0", "+10,0", 2)]
66-
[TestCase("0,0", 1, "-10,-1", "+10,-1", 1 )]
67-
[TestCase("0,0", 1, "-10,-10", "+10,-10", 0)]
68-
public void CircleIntersectWithLine2D_NumberOfIntersections(string sc, double radius, string sps, string spe, int expectedNumberOfIntersections)
63+
[TestCase("0,0", 1, "-10,+10", "+10,+10", "empty")]
64+
[TestCase("0,0", 1, "-10,+1", "+10,+1", "0,+1")]
65+
[TestCase("0,0", 1, "-10,0", "+10,0", "-1,0;+1,0")]
66+
[TestCase("0,0", 1, "-10,-1", "+10,-1", "0,-1" )]
67+
[TestCase("0,0", 1, "-10,-10", "+10,-10", "empty")]
68+
public void CircleIntersectWithLine2D_NumberOfIntersections(string sc, double radius, string sps, string spe, string expectedIntersectionsAsString)
6969
{
7070
var circle = new Circle2D(Point2D.Parse(sc), radius);
7171
var line = new Line2D(Point2D.Parse(sps), Point2D.Parse(spe));
7272

7373
var actual = circle.IntersectWith(line);
7474

75-
Assert.That(actual.Count(), Is.EqualTo(expectedNumberOfIntersections));
75+
var expected = parseToPointsArray(expectedIntersectionsAsString);
76+
CollectionAssert.AreEquivalent(expected, actual);
7677
//TODO: the intersection should be on the circle
7778
Assert.That(actual.All(p => Math.Abs(circle.Center.DistanceTo(p) - circle.Radius) < 1e-6), Is.EqualTo(true), "distance between center and intersection");
7879
//TODO: the intersection should be on the line

0 commit comments

Comments
 (0)