04.12.2012 Views

Testing, Debugging, and Verification - Testing, Part II

Testing, Debugging, and Verification - Testing, Part II

Testing, Debugging, and Verification - Testing, Part II

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basic JUnit usage<br />

continued from prev page<br />

...<br />

public s t a t i c int [] insert ( int [] x, int n) {<br />

int [] y = new int [x. length + 1];<br />

int i;<br />

for (i = 0; i < x. length ; i ++) {<br />

i f (n < x[i]) break;<br />

y[i] = x[i];<br />

}<br />

y[i] = n;<br />

for (; i < x. length ; i ++) {<br />

y[i +1] = x[i];<br />

}<br />

return y;<br />

}<br />

}<br />

TDV: <strong>Testing</strong> /GU 121130 20 / 28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!