Added more tests.

Signed-off-by: Marcin Zalewski <marcin.zalewski@gmail.com>
Added a test.

Signed-off-by: Marcin Zalewski <marcin.zalewski@gmail.com>
Added rotate algorithm, tests, and fixed some bugs.

Signed-off-by: Marcin Zalewski <marcin.zalewski@gmail.com>