Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

answer the three following question: 1)How many test cases would be required to

ID: 3825657 • Letter: A

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 )
{
    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;
}

Explanation / Answer

The answer to the 1st question is that it will require a total of 10 tesyt cases for the following function as for the 1st if statement it require 6 test case and for the 2nd if conditiion it requires 4 test cases