|
|
@@ -13,15 +13,16 @@
|
|
|
#include "test_printers.h"
|
|
|
|
|
|
using namespace math::dim2;
|
|
|
+using namespace testing;
|
|
|
|
|
|
-struct FromOriginTest : testing::TestWithParam<line> {};
|
|
|
+struct FromOriginTest : TestWithParam<line> {};
|
|
|
|
|
|
TEST_P(FromOriginTest, IntersectsAtOrigin) {
|
|
|
line l1 = { GetParam().first, {{0, 0}} };
|
|
|
line l2 = { {{0, 0}}, GetParam().second };
|
|
|
|
|
|
EXPECT_THAT(math::lines::intersection(l1, l2),
|
|
|
- testing::Eq(point{{0, 0}}));
|
|
|
+ Eq(point{{0, 0}}));
|
|
|
}
|
|
|
|
|
|
std::vector<line> const point_pairs{
|
|
|
@@ -40,16 +41,16 @@ std::vector<line> const point_pairs{
|
|
|
};
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(LineIntersection, FromOriginTest,
|
|
|
- testing::ValuesIn(point_pairs));
|
|
|
+ ValuesIn(point_pairs));
|
|
|
|
|
|
-struct XUnitTest : testing::TestWithParam<point> {};
|
|
|
+struct XUnitTest : TestWithParam<point> {};
|
|
|
|
|
|
TEST_P(XUnitTest, OrthoOnIntersection) {
|
|
|
line const ln{{{0, 0}}, {{1, 0}}};
|
|
|
point const pt = GetParam();
|
|
|
line const expected{pt, {{pt[0], 0}}};
|
|
|
EXPECT_THAT(math::lines::orthogonal(ln, pt),
|
|
|
- testing::Eq(expected));
|
|
|
+ Eq(expected));
|
|
|
}
|
|
|
|
|
|
std::vector<point> x_orthos{
|
|
|
@@ -58,17 +59,16 @@ std::vector<point> x_orthos{
|
|
|
{{2, 1}}, {{1, 2}}, {{-2, 1}}, {{-1, 2}}, {{1, -2}}, {{2, -1}}
|
|
|
};
|
|
|
|
|
|
-INSTANTIATE_TEST_CASE_P(LineOrthogonal, XUnitTest,
|
|
|
- testing::ValuesIn(x_orthos));
|
|
|
+INSTANTIATE_TEST_CASE_P(LineOrthogonal, XUnitTest, ValuesIn(x_orthos));
|
|
|
|
|
|
-struct DiagonalTest : testing::TestWithParam<std::pair<point, float>> {};
|
|
|
+struct DiagonalTest : TestWithParam<std::pair<point, float>> {};
|
|
|
|
|
|
TEST_P(DiagonalTest, OrthoOnIntersection) {
|
|
|
line const ln{{{0, 0}}, {{1, 1}}};
|
|
|
point const pt = GetParam().first;
|
|
|
line const expected{pt, {{GetParam().second, GetParam().second}}};
|
|
|
EXPECT_THAT(math::lines::orthogonal(ln, pt),
|
|
|
- testing::Eq(expected));
|
|
|
+ Eq(expected));
|
|
|
}
|
|
|
|
|
|
std::vector<std::pair<point, float>> diag_orthos{
|
|
|
@@ -81,4 +81,4 @@ std::vector<std::pair<point, float>> diag_orthos{
|
|
|
};
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(LineOrthogonal, DiagonalTest,
|
|
|
- testing::ValuesIn(diag_orthos));
|
|
|
+ ValuesIn(diag_orthos));
|