testSwapEnds