rotate_copy algorithm and test