OpenWalnut
1.5.0dev
|
Unit tests the WLine class. More...
#include <WLine_test.h>
Public Member Functions | |
void | testEqualsDeltaDifferentLength (void) |
If two lines have different lengths they are considered diffrent regardless on the given delta and the first point on which they differ should be returned. More... | |
void | testEqualsDeltaOnRealDifferentLines (void) |
If both lines are of same size, but there is a point differing on more than the given delta the first point which differs should be returned. More... | |
void | testEqualsDeltaOnDifferentLinesButWithinDelta (void) |
If both lines are of same size and every point pair don't differ in terms of the given delta, -1 should be returned. More... | |
void | testOutputOperator (void) |
When printing a line to stdout it the output should be as follows: [first_pos, ..., last_pos] where the positions also should be in the same format, so in the end we would have: [[0,1,0],...[0,0,0]]. More... | |
void | testEqualityOperator (void) |
Two Lines are equal if they have the same points in the same order. More... | |
void | testAccessOperatorWithinValidBounds (void) |
When accessing an item within 0..length-1 a const reference to the WPosition object should be returned. More... | |
void | testReverseOrdering (void) |
If for example the start and end points of two lines are in opposite direction we may want to change its direction. More... | |
void | testPathLength (void) |
The path length of the line is the accumulated path lengths of all segements (point to point) in that line. More... | |
void | testDownSampleLine (void) |
When resampling a line a new line is generated having the given number of sampling points. More... | |
void | testSamplingWithSameNumberOfPoints (void) |
If the resampling rate of a line has as many points as the original line, no sampling should be applied. More... | |
void | testSamplingPointsAreExactlyInTheOldSegmentCenterAndCorners (void) |
If the points are exactly in between of a segement nothing should fail. More... | |
void | testNumericalStabilityOfResampling (void) |
When resampling with many sample points the numerical errors may sum up. More... | |
void | testManySampelsInBetweenOfTwoOldPoints (void) |
If there are many new sample points between two old sample points nothing should fail either. More... | |
void | testMidPointOnEvenSize (void) |
The mid point of a WLine is just the point in the middle of the line. More... | |
void | testMidPointOnUnevenSize (void) |
When a line has uneven numbered size, the mid point is unique. More... | |
void | testMidPointOnEmptyLine (void) |
When calling midPoint on empty lines => there is no point to return hence an exception is generated. More... | |
void | testMaxSegementLength (void) |
The max segemnent length is the maximum length over all segments (p_i<->p_j). More... | |
void | testEmptyLineOnMaxSegementLength (void) |
If there no points at all, 0.0 shall be returned. More... | |
void | testRemoveAdjacentDuplicates (void) |
If there are duplicates next to each other => collapse them. More... | |
void | testResamplingByNewSegmentLengthWithZeroLine (void) |
No sample points should remain no sample points. More... | |
void | testResamplingByNewSegementLengthWithLineHavingJustOnePoint (void) |
Lines with size() == 1, should also remain untouched. More... | |
void | testResamplingByNewSegementLengthOldSegmentLengthBiggerAsNewSegmentLength (void) |
If there is a segement bigger than the newSegmentLength, then the new segment should be inserted and then with the new point should be proceeded just the same. More... | |
void | testResamplingByNewSegementLengthTravelingOutOfTheCircle (void) |
Only if a sample point comes out of the circle with radius newSegmentLength then append the point of intersection. More... | |
Private Member Functions | |
void | assert_equals_delta (const WLine &first, const WLine &second, double delta=wlimits::DBL_EPS) const |
TS_ASSERT_DELTA needs the operator+, operator- and operator< to be implemented especially for WPositions the operator< and operator + makes not really sense. More... | |
Unit tests the WLine class.
Definition at line 42 of file WLine_test.h.
|
inlineprivate |
TS_ASSERT_DELTA needs the operator+, operator- and operator< to be implemented especially for WPositions the operator< and operator + makes not really sense.
Hence I implemented an assert by my one, giving reasonable out put.
first | First line to compare with |
second | Second line to compare with |
delta | The delta within two points are considered as equally |
Definition at line 428 of file WLine_test.h.
References WMixinVector< ValueT >::size().
Referenced by testDownSampleLine(), testManySampelsInBetweenOfTwoOldPoints(), testNumericalStabilityOfResampling(), testRemoveAdjacentDuplicates(), testResamplingByNewSegementLengthOldSegmentLengthBiggerAsNewSegmentLength(), testResamplingByNewSegementLengthTravelingOutOfTheCircle(), testResamplingByNewSegementLengthWithLineHavingJustOnePoint(), testResamplingByNewSegmentLengthWithZeroLine(), testSamplingPointsAreExactlyInTheOldSegmentCenterAndCorners(), and testSamplingWithSameNumberOfPoints().
|
inline |
When accessing an item within 0..length-1 a const reference to the WPosition object should be returned.
Definition at line 133 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
When resampling a line a new line is generated having the given number of sampling points.
Its start and end points remain the same, but its curvature may change a bit and also its length! Down sampling means you will have
Definition at line 182 of file WLine_test.h.
References assert_equals_delta(), wlimits::DBL_EPS, WMixinVector< ValueT >::push_back(), and WLine::resampleByNumberOfPoints().
|
inline |
If there no points at all, 0.0 shall be returned.
Definition at line 331 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
Two Lines are equal if they have the same points in the same order.
Definition at line 114 of file WLine_test.h.
References WMixinVector< ValueT >::back(), and WMixinVector< ValueT >::push_back().
|
inline |
If two lines have different lengths they are considered diffrent regardless on the given delta and the first point on which they differ should be returned.
Definition at line 50 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
If both lines are of same size and every point pair don't differ in terms of the given delta, -1 should be returned.
Definition at line 80 of file WLine_test.h.
References wlimits::DBL_EPS, and WMixinVector< ValueT >::push_back().
|
inline |
If both lines are of same size, but there is a point differing on more than the given delta the first point which differs should be returned.
Definition at line 65 of file WLine_test.h.
References wlimits::DBL_EPS, and WMixinVector< ValueT >::push_back().
|
inline |
If there are many new sample points between two old sample points nothing should fail either.
Definition at line 258 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), and WLine::resampleByNumberOfPoints().
|
inline |
The max segemnent length is the maximum length over all segments (p_i<->p_j).
BTW: If there are multiple max lengths (equidistant sampled tracts) the first shall be chosen
Definition at line 317 of file WLine_test.h.
References wlimits::DBL_EPS, and WMixinVector< ValueT >::push_back().
|
inline |
When calling midPoint on empty lines => there is no point to return hence an exception is generated.
Definition at line 306 of file WLine_test.h.
References WException::what().
|
inline |
The mid point of a WLine is just the point in the middle of the line.
For lines with even numbered size the element before that non existing midPoint is selected.
Definition at line 278 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
When a line has uneven numbered size, the mid point is unique.
Definition at line 292 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
When resampling with many sample points the numerical errors may sum up.
Hence I watch if it not breaks a certain threshold: 1.0e-10*newSegmentLength.
Definition at line 236 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::pop_back(), WMixinVector< ValueT >::push_back(), and WLine::resampleByNumberOfPoints().
|
inline |
When printing a line to stdout it the output should be as follows: [first_pos, ..., last_pos] where the positions also should be in the same format, so in the end we would have: [[0,1,0],...[0,0,0]].
Definition at line 97 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
The path length of the line is the accumulated path lengths of all segements (point to point) in that line.
Definition at line 165 of file WLine_test.h.
References WMixinVector< ValueT >::push_back().
|
inline |
If there are duplicates next to each other => collapse them.
Definition at line 342 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), and WLine::removeAdjacentDuplicates().
|
inline |
If there is a segement bigger than the newSegmentLength, then the new segment should be inserted and then with the new point should be proceeded just the same.
Definition at line 387 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), and WLine::resampleBySegmentLength().
|
inline |
Only if a sample point comes out of the circle with radius newSegmentLength then append the point of intersection.
Definition at line 403 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), and WLine::resampleBySegmentLength().
|
inline |
Lines with size() == 1, should also remain untouched.
Definition at line 374 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), and WLine::resampleBySegmentLength().
|
inline |
No sample points should remain no sample points.
Definition at line 364 of file WLine_test.h.
References assert_equals_delta(), and WLine::resampleBySegmentLength().
|
inline |
If for example the start and end points of two lines are in opposite direction we may want to change its direction.
Definition at line 147 of file WLine_test.h.
References WMixinVector< ValueT >::push_back(), and WLine::reverseOrder().
|
inline |
If the points are exactly in between of a segement nothing should fail.
Definition at line 217 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::pop_back(), WMixinVector< ValueT >::push_back(), and WLine::resampleByNumberOfPoints().
|
inline |
If the resampling rate of a line has as many points as the original line, no sampling should be applied.
Definition at line 201 of file WLine_test.h.
References assert_equals_delta(), WMixinVector< ValueT >::push_back(), WLine::resampleByNumberOfPoints(), and WMixinVector< ValueT >::size().