banner image
Sedang Dalam Perbaikan

Contract for square root routine keeping in view unit testing.

Below is the chunk of code :

result = squareRoot(argument);
assert (abs (result * result – argument) < epsilon);

Write the Contract for square root routine keeping in view unit testing.


  • Pass in a negative argument and ensure that it is rejected
  • Pass in an argument of zero to ensure that it is accepted (this is a boundary value)
  • Pass in values between zero and the maximum expressible argument and verify that the difference between the square of the result and the original argument is less than some value epsilon.
Contract for square root routine keeping in view unit testing. Contract for square root routine keeping in view unit testing. Reviewed by MCH on July 17, 2012 Rating: 5

No comments:

Powered by Blogger.