Test for detecting cycle