swap until for while in test