UTBotCpp icon indicating copy to clipboard operation
UTBotCpp copied to clipboard

Verify data written to the file during test execution

Open tyuldashev opened this issue 3 years ago • 0 comments

Description If user code writes to the file it would be great if UTBot "predicts" what should be a result of test execution during test generation and then verify file content after actual execution of the test.

For example let's look at file_fwrite function from c-examples:

char file_fwrite(FILE *fA, int x) {
  if (x > 0) {
    char a[] = "Positive";
    fwrite(a, sizeof(char), 8, fA);
    return 'P';
  } else if (x < 0) {
    char a[] = "Negative";
    fwrite(a, sizeof(char), 8, fA);
    return 'N';
  } else {
    char a[] = "Zero";
    fwrite(a, sizeof(char), 4, fA);
    return 'Z';
  }
}

Not sure it's possible in practice, but in theory UTBot could deduct during test generation what word would be written to file ('Positive', 'Negative' or 'Zero') based on provided x. Then we could compare that 'predicted' output with what was really written to the file.

tyuldashev avatar Oct 20 '22 11:10 tyuldashev