Test string rotation algorithm.