Generalized distanceMeasureTest to act on samples of any length