Added tests for wrapIndex