How to write testcases for n factorial? How many test cases will we get?

Questions by yammy   answers by yammy

Showing Answers 1 - 9 of 9 Answers

Nalini

  • Aug 30th, 2006
 

n! means n(n-1)(n-2)......3,2,1First Check the given integer is positive If the given integer is negative,n! is not defined If the given number is fraction,n! is not defined check the given number is 0,n! is 1hope u'll get an idea...if any wrong in this....correct me...

  Was this answer useful?  Yes

tnalini

  • Aug 30th, 2006
 

n! :n(n-1)(n-2).....3,2,1.First TC: Check the given integer is positive If the given number is negative, ExpectedResult : n! is not defined If the given integer is fraction. n! is not defind TC : check the given number is 0 (0!=1) ER: 1 is displayed Hope u'll get an idea...correct if it's wrong

  Was this answer useful?  Yes

Factorials are represented by n! 

Examples:  3! = 1 * 2 * 3 = 6
          4! = 1 * 2 * 3 * 4 = 24
          5! = 1 * 2 * 3 * 4 * 5 = 120

A factorial program is easy to test because you are simply testing the input  value for an integer variable related to a single text box and then verifying its output value.  Here are the test cases:

Determine the maximum integer value that the computer can calculate its factorial.  This value becomes the upper boundary.

POSITIVE TEST CASES

1) Submit integer value at lower boundary [ 0 ]
2) Submit integer value at lower boundary +1 [ 1 ]
3) Submit integer value at upper boundary -1
4) Submit integer value at upper boundary

NEGATIVE TEST CASES

5) Submit integer value at upper boundary +1
6) Submit integer value with leading 0
7) Submit integer value with leading plus sign [+]
8) Submit integer value with leading minus sign [-]
9) Submit integer value with leading space
10) Submit number with decimal point
12) Submit number with the letter 'e' in it
13) Submit alpha character(s)
14) Submit special character(s) [ex: !@#$^]
15) Submit with only space
16) Submit with nothing entered

  Was this answer useful?  Yes

sai kiran reddy

  • Jun 2nd, 2016
 

Factorial of a given number should not be negative numbers, decimal point numbers, alpha characters, special characters and if it is function, it takes only one parameter.

  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