33 #define BOOST_TEST_MODULE ( hit_test )
34 #include "boost/test/unit_test.hpp"
85 BOOST_TEST(e.
ID() == EinvID);
88 BOOST_TEST(e.
Length() == 0.0);
91 BOOST_TEST(!(e < e.
ID()));
92 BOOST_TEST(!(e.
ID() <
e));
94 std::cout <<
"Printout of a default-constructed edge: " << e << std::endl;
139 BOOST_TEST(e.
ID() == 3);
142 BOOST_TEST(e.
Length() == 3.0);
144 BOOST_TEST(!(e < e));
145 BOOST_TEST(!(e < e.
ID()));
146 BOOST_TEST(!(e.
ID() <
e));
148 std::cout <<
"Printout of a value-constructed edge: " << e << std::endl;
152 BOOST_TEST( (e < o));
153 BOOST_TEST(!(o < e));
154 BOOST_TEST( (e < o.
ID()));
155 BOOST_TEST(!(o.
ID() <
e));
209 std::array<double, 3U>
const error = {{ 0.1, 0.1, 0.1 }};
210 std::array<double, 3U> point;
214 point = {{ 1.0, 1.0, 1.0 }};
219 point = {{ 4.0, 5.0, 13.0 }};
224 BOOST_TEST(e.ID() == 0);
225 BOOST_TEST(e.FirstPointID() == 0);
226 BOOST_TEST(e.SecondPointID() == 1);
227 BOOST_CHECK_CLOSE(e.Length(), 13.0, 1e-4);
229 std::cout <<
"Printout of a spacepoint-constructed edge: " << e << std::endl;
240 std::array<double, 3U>
const error = {{ 0.1, 0.1, 0.1 }};
241 std::array<double, 3U>
const point = {{ 1.0, 1.0, 1.0 }};
242 std::vector<recob::SpacePoint> points;
243 for (
unsigned int i = 0; i < 10; ++i)
244 points.emplace_back(point.data(), error.data(), 1.0, i);
250 if (!std::is_sorted(points.begin(), points.end()))
251 throw std::runtime_error(
"Space points not sorted!");
254 auto const iFirstPoint = std::lower_bound
257 if ((iFirstPoint == points.end()) || (iFirstPoint->ID() != edge.
FirstPointID())) {
258 throw std::runtime_error
264 auto const iSecondPoint = std::lower_bound
267 if ((iSecondPoint == points.end()) || (iSecondPoint->ID() != edge.
SecondPointID())) {
268 throw std::runtime_error
274 BOOST_TEST(&firstPoint == &points[3]);
275 BOOST_TEST(&secondPoint == &points[6]);
An object to define a "edge" which is used to connect space points in a triangulation algorithm...
void EdgeTestValueConstructor()
static constexpr ID_t InvalidID
Special value for an invalid edge ID.
double Length() const
Returns the length of this edge [cm].
void EdgeTestSpacePointConstructor()
void EdgeTestDefaultConstructor()
SpacePointID_t FirstPointID() const
Returns the ID of the SpacePoint this edge emanates from.
static constexpr ID_t InvalidID
Special value for an invalid ID.
std::string to_string(WindowPattern const &pattern)
void EdgeClassDocumentationTest()
ID_t ID() const
Returns the ID of this edge.
physics associatedGroupsWithLeft p1
BEGIN_PROLOG could also be cout
Edge is an object containing the results of a Principal Components Analysis of a group of space point...
SpacePointID_t SecondPointID() const
Returns the ID of the SpacePoint this edge ends on.