Ad Code

Discus the symptoms and an example of coding error bug class.

Discus the symptoms and an example of coding error bug class.



Symptoms:

  • Unexpected errors in black box testing.
  • The errors that unexpectedly occur are usually caused by coding errors.
  • Compiler warnings.
  • Coding errors are usually caused by lack of attention to details.
Example: 
In the following example, a function accepts an input integer and converts it into a string that contains that integer in its word representation.

void convertToString(int InInteger, char* OutString, int* OutLength) {
switch(InInteger)
{
case 1: OutString = "One";
OutLength = 3;
break;
case 2: OutString = "Two";
OutLength = 3;
break;
case 3: OutString = "Three";
OutLength = 5;
break;
case 4: OutString = "Four";
OutLength = 4;
break;
case 5: OutString = "Five";
OutLength = 4;
break;
case 6: OutString = "Six";
OutLength = 3;
break;
case 7: OutString = "Seven";
OutLength = 5;
break;
case 8: OutString = "Eight";
OutLength = 5;
break;
case 9: OutString = "Nine";
OutLength = 4;
break;
}
}
Reactions

Post a Comment

0 Comments