Tuesday, September 22, 2015

Equivalence Class Partitioning Examples

Example 1:
Write test-cases for testing a power function which has the following signature:
int power(int m, int n)
and returns the result of m raised to the power of n.

The Number line can be divided into sections as shown below:
1. [MIN, -k]: where k is a value which lies between MIN and MAX, but the result of k raised to the power of k can be above MAX value.
2. [-k, 0]
3. [0,k]
4. [k, MAX]
Test-cases can be formed by taking one value from each section.
Test-cases for power function:
Total number of possible values for m with the above equivalence class partitioning: 5
Total number of possible values for n with the above equivalence class partitioning: 5
Total number of test-cases: 5*5 = 25

2 comments: