Cycle generation passing JUnit

Fixed edge case with zero-length chain/cycle cap.