Details of this Paper

You are going to write tests for the following program.;Its requirements are to;Take an integer array data of SIZE elements;Take...

Description

solution


Question

You are going to write tests for the following program.;Its requirements are to;Take an integer array data of SIZE elements;Take a positive, non-null, integer value n;If the value is null or negative, the program should not alter the array;If it is positive, each element in the array should be shifted right by n positions;If an element is pushed past the end of the array, we keep pushing it as if the end of the array connected to its start. Our array is a kind of ?ring?.;Your objective is to write tests which will guarantee;The program conforms to the requirements, the program below might or might not, your tests need to be able to determine this;All possible execution paths have been tested;Your program does not feature any of the novice errors discussed in the textbook / videos / ?;Program to Test;// all arrays in this program will have same size;#define SIZE 3;void rotate(int data[], int n);int index = 0;int tmp[SIZE];// copying data into tmp array;for(index = 0, index < SIZE, index++);tmp[index] = data[index];for(index = 0, index < SIZE, index++);next = (index + n) % SIZE;data[next] = tmp[index]

 

Paper#64470 | Written in 18-Jul-2015

Price : $22
SiteLock