This question already has an answer here:
I am creating a unit test harness for my program and I want the harness to test randomly each run.
The PROBLEM:
I am having trouble returning a string. This is a school assignment as well. I'm looking for some advice and guidance.
The function "stringOptions" is not able to return a string correctly to pass through into the "assessGrade" function.
Here's some code snipits:
int main (void)
{
int testNumber = 1; // forcing it to choose the first option for testing purposes
char* stringPtr = NULL;
double finalGrade = 0;
stringPtr = stringOptions(testNumber);
finalGrade = assessGrade(stringGrade); // assesGrade takes a string and returns a double as the result
studentGradeCondition(finalGrade); // prints out the student's resulting grade
return 0;
}
char * stringOptions (int randomNum)
{
char incomplete[2] = "I";
if (randomNum == 1)
{
return incomplete;
}
}
I have a random number generator creating different number and normally "stringOptions" will have all the different type of string that could be tested.
Aucun commentaire:
Enregistrer un commentaire