Open
Description
Description
Currently test file content is formed from number of adjacent one-letter stings. It would take less space and would be easier to read if that would be just one string.
To Reproduce
Steps to reproduce the behavior:
- Generate tests for code which are using files, for instance use following code (extraction from
file.c
:
int file_fgets(FILE *fA) {
char a[8];
fgets(a, 6, fA);
if (a[0] == 'u' && a[1] == 't' && a[2] == 'b' && a[3] == 'o' && a[4] == 't') {
return 1;
}
return 0;
}
Actual behavior
Tests stary with following code:
TEST(regression, file_fgets_test_1)
{
write_to_file("../../../tests/src/A", "ut\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n");
write_to_file("../../../tests/src/B", "\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0");
write_to_file("../../../tests/src/C", "\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0""\0");
...
}
Note that strings written to file consists of one letter strings. While I believe it would be more convenient to concatenate them before test generation so they would look:
TEST(regression, file_fgets_test_1)
{
write_to_file("../../../tests/src/A", "ut\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
write_to_file("../../../tests/src/B", "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
write_to_file("../../../tests/src/C", "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
...
Metadata
Metadata
Assignees
Type
Projects
Status
Todo