-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Labels
bugSomething isn't workingSomething isn't workingregressionRegressionRegressionverifiedBug fix is verifiedBug fix is verified
Description
Description
Even function under test doesn't perform any operations on files UTBot still adds test input initialization to the tests
To Reproduce
Generate test for something simple like:
int div(int a, int b) {
return a / b;
}
Expected behavior
Generated tests does not involve interactions with file system
Actual behavior
Generated tests contain section which initialize file as test input:
TEST(regression, div_test_1)
{
write_to_file("../../../tests/src/A", "\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/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");
int actual = div2(0, 1);
EXPECT_EQ(0, actual);
}
Additional information
UTBot always create three file no matter how many is actually needed. In case we implement logic that count number of parameters of FILE type and create only required number of files then it should resolve problem described above and issue with writing more files than actually required.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingregressionRegressionRegressionverifiedBug fix is verifiedBug fix is verified
Type
Projects
Status
Done