Write a Test Case on a program that calculates P=R/I where R, I are integer inputs and P a floating point output.

Showing Answers 1 - 4 of 4 Answers

Ethele

  • Sep 14th, 2006
 

It seems to me that the obvious case would be a test case to check to see if P is, in fact, R/I and not a truncated R/I integer value stored in a floating point. An easy programming error would be to not cast R and I as floats before division, and integer division will be truncated before being assigned to P. Any R and I pair where R is not evenly divisible by I would work for this. Say, make sure that R=3 and I=2 gives a float P of 1.5, not 1.0.

  Was this answer useful?  Yes

s.lakshmipriya

  • Feb 19th, 2007
 

testcase id    testcasedescription  action  testinput expectedresult  actualresult
001                we should find
                         p=R/Iwhere
                      R and I are integers    calculate P egR=3

                    and P is float                 I=2,P=1.5               we get  P as float where R
  
                                                                                            and I as integers. 
expected result= actual result=pass
expected result# actual result=fail

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions