Below is a variant of the Pig Latin program we used in the debugging contest. It's supposed to translate text, found in a file called testinput0.txt, into Pig Latin.
The rules of Pig Latin are that a word that starts with a vowel is translated by adding "ay" to the end, and a word that starts with a consonant has the consonant moved to the end, and then "ay" added.
You will find that the program more or less works. For example, if you out this in your test file
here is some text for translation into pig latin
it will correctly produce this result:
erehay isway omesay exttay orfay ranslationtay intoway igpay atinlay
Your challenge is to demonstrate (not fix) as many failures of the program as you can. A failure is any situation in which the program does not behave as desired. This can happen because the program produces output that is different from what the user wants, or because the program crashes.
Note the a failure can occur even in "correct" code, if the requirements the code implements don't actually agree with what the user wants. While failures usually reflect defects in the code, in this case they reflect defects in the requirements.
Black Box and White Box testing.
In Black Box testing you find failures by testing the executable program, without examining the code. In White Box testing you do get to examine the code.
Start the testing contest with Black Box testing. Compile the code without looking at it. Then create a file testinput0.txt and test the executable. You can put whatever you want in your test file, and change it as often as you like. Note any failures you demonstrate.
At an agreed time, we'll switch to White Box testing. Here you get to examine the code. See how many more failures you can demonstrate.
There'll be worthless prizes for teams that find defects other teams don't find, as well as for the team that finds the most different failures (failures are different if they involve different defects, which may involve looking at the code to score.)
//Pig Latin program modified to serve as testing example
#define MAX 100
#define MAXW 10
void piglatin(char input);
int isvowel(char c);
void stripfirst(char input);
void addletter(char input,char c);
int last(char input);
printf("The translation is: \n");
void piglatin(char input)
int isvowel(char c)
void stripfirst(char input)
void addletter(char input,char c)
int last(char input)