|
|
@@ -100,18 +100,35 @@ TEST_P(LineQuadTest, OriginLineIntersectsUnitSquare) {
|
|
|
square const unit{{{0, 0}}, 1};
|
|
|
line const ln{{{0, 0}}, GetParam()};
|
|
|
EXPECT_TRUE(math::intersects(ln, unit));
|
|
|
+ EXPECT_TRUE(math::intersects(unit, ln));
|
|
|
+}
|
|
|
+
|
|
|
+TEST_P(LineQuadTest, CrossingLineIntersectsUnitSquare) {
|
|
|
+ square const unit{{{0, 0}}, 1};
|
|
|
+ line const ln{{{0.5, 0.5}}, GetParam()};
|
|
|
+ EXPECT_TRUE(math::intersects(ln, unit));
|
|
|
+ EXPECT_TRUE(math::intersects(unit, ln));
|
|
|
+}
|
|
|
+
|
|
|
+TEST_P(LineQuadTest, CrossingLineIntersectsSquare) {
|
|
|
+ square const unit{{{0, 0}}, 0.9};
|
|
|
+ line const ln{{{0.5, 0.5}}, GetParam()};
|
|
|
+ EXPECT_TRUE(math::intersects(ln, unit));
|
|
|
+ EXPECT_TRUE(math::intersects(unit, ln));
|
|
|
}
|
|
|
|
|
|
TEST_F(LineQuadTest, JustPointIntersection) {
|
|
|
square const unit{{{0, 0}}, 1};
|
|
|
line const ln{{{1, 1}}, {{2, 1}}};
|
|
|
EXPECT_TRUE(math::intersects(ln, unit));
|
|
|
+ EXPECT_TRUE(math::intersects(unit, ln));
|
|
|
}
|
|
|
|
|
|
TEST_F(LineQuadTest, EntirelyEncasedIntersection) {
|
|
|
square const unit{{{0, 0}}, 1};
|
|
|
line const ln{{{0.5, 0.5}}, {{0.75, 0.75}}};
|
|
|
EXPECT_TRUE(math::intersects(ln, unit));
|
|
|
+ EXPECT_TRUE(math::intersects(unit, ln));
|
|
|
}
|
|
|
|
|
|
TEST_F(LineQuadTest, OutsideByAnInch) {
|
|
|
@@ -119,6 +136,7 @@ TEST_F(LineQuadTest, OutsideByAnInch) {
|
|
|
line const ln{{{1.001, 1}}, {{2, 1}}};
|
|
|
math::intersects(ln, unit);
|
|
|
EXPECT_FALSE(math::intersects(ln, unit));
|
|
|
+ EXPECT_FALSE(math::intersects(unit, ln));
|
|
|
}
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(Intersects, LineQuadTest, ValuesIn(line_ends));
|