Skip to content

Verify data written to the file during test execution #510

Open
@tyuldashev

Description

@tyuldashev

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions