Implementing a Rotatable Array class

You are trying to implement a RotatableArray class, whose main feature is a rotate function. This function takes a positive or negative integer and rotates all of the elements of the array according to its input (rotating right for positive inputs and left for negative inputs).

For example, if the array contained [1, 2, 3, 4, 5, 6, 7, 8, 9] and we called rotate(3), the array should contain [7, 8, 9, 1, 2, 3, 4, 5, 6]. Note that all elements have shifted to the right 3 positions, with the elements that shift “off the edge” of the array “rotating” back around to the other side.

Describe at least 2 interesting black-box test cases for RotatableArray::rotate. For each test case, indicate a) the contents of the array before rotating, b) the input parameter to the rotate function, c) the expected contents of the array after rotating, and d) what you are trying to test with this test case. You should not use the example above as one of your test cases.

find the cost of your paper

This question has been answered.

Get Answer