@Test
public void testGetDistanceToEnd() {

   	assertEpsilonEquals(this.testedSegment.getOriginalLength(),this.testedSegment.getDistanceToEnd(0));
   	assertEpsilonEquals(this.firstNeighbour.getOriginalLength(),this.firstNeighbour.getDistanceToEnd(0));
   	assertEpsilonEquals(this.secondNeighbour.getOriginalLength(),this.secondNeighbour.getDistanceToEnd(0));
   	assertEpsilonEquals(this.loopSegment.getOriginalLength(),this.loopSegment.getDistanceToEnd(0));
   	assertEpsilonEquals(this.thirdNeighbour.getOriginalLength(),this.thirdNeighbour.getDistanceToEnd(0));
   	//
   	assertEpsilonEquals(0.,this.testedSegment.getDistanceToEnd(1));
   	assertEpsilonEquals(0.,this.firstNeighbour.getDistanceToEnd(1));
   	assertEpsilonEquals(0.,this.secondNeighbour.getDistanceToEnd(1));
   	assertEpsilonEquals(0.,this.loopSegment.getDistanceToEnd(1));
   	assertEpsilonEquals(0.,this.thirdNeighbour.getDistanceToEnd(1));
   	//
   	Random rnd = new Random();
   	double ratio;
   	for(int i=0; i<TEST_COUNT; ++i) {
   		ratio = rnd.nextDouble();
   		assertEpsilonEquals(this.testedSegment.getOriginalEndDistance(ratio),this.testedSegment.getDistanceToEnd(ratio));
   		assertEpsilonEquals(this.firstNeighbour.getOriginalEndDistance(ratio),this.firstNeighbour.getDistanceToEnd(ratio));
   		assertEpsilonEquals(this.secondNeighbour.getOriginalEndDistance(ratio),this.secondNeighbour.getDistanceToEnd(ratio));
   		assertEpsilonEquals(this.loopSegment.getOriginalEndDistance(ratio),this.loopSegment.getDistanceToEnd(ratio));
   		assertEpsilonEquals(this.thirdNeighbour.getOriginalEndDistance(ratio),this.thirdNeighbour.getDistanceToEnd(ratio));
   	}
}