mardi 21 avril 2020

White-box testing reverse digit

int reverse(int n)
{
    bool isNegative  = false;
    if (n<0) {
      isNegative = true;
      n = -n;
    }
    int result = 0;
    while (n>0){
      result = result * 10 + n % 10;
      n /= 10;
    }
    if (isNegative == true )
      result = -result;
    return result;
} 

flow-graph I drew enter image description here

1.Least test case required to cover all statements? ( I think it's 1. If n = -1 will cover all statements) 2.Max test case required for path testing? 3.Least test case required to cover all conditions? 4.Design test case for path testing

I'm new to testing and I find these very confusing. Can someone help me with this? Many thanks

Aucun commentaire:

Enregistrer un commentaire