Question: answer the three following question: 1)How many test cases would be required to achieve statement coverage of this method? float myFunc( float x, float y
answer the three following question:
1)How many test cases would be required to achieve statement coverage of this method?
float myFunc( float x, float y ) { float z = 0; if ( ( x > 2 ) && ( y != 0 ) ) z = x / 3; if ( ( x == 3 ) || ( y > 1 ) ) z = 2 * x; return z; }
2)How many paths would there be in a basis set for this code?
void myMin( int x, int, y, int z ) { int minimum = 0; if ( ( x <= y ) && ( x <= z) ) minimum = x; if ( ( y <= x ) && ( y <= z ) ) minimum = y; if ( ( z <= x ) && ( z <= y ) ) minimum = z; else minimum = -99; return minimum; }
3)How many combinations would be required to achieve decision/condition coverage in the following code?
void myMin( int x, int, y, int z )
{ int minimum = 0; if ( ( x <= y ) && ( x <= z) ) minimum = x; if ( ( y <= x ) && ( y <= z ) ) minimum = y; if ( ( z <= x ) && ( z <= y ) ) minimum = z; else minimum = -99; return minimum; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
