UTBotCpp icon indicating copy to clipboard operation
UTBotCpp copied to clipboard

`ferror` confuses UTBot so it creates failing regression test

Open tyuldashev opened this issue 3 years ago • 0 comments

Description In case there is ferror check in user code then UTBot may generate regression test which fails

To Reproduce Generate and run tests for following code:

#include <stdio.h>

int help(FILE *file)
{
    fputs("help text", file);
    if (ferror(file))
        return -1;
    return 0;
}

Expected behavior Test are generated. Regression tests pass.

Actual behavior One regression test is generated, which fails during execution:

TEST(regression, help_test_1)
{
    struct _IO_FILE * file = (UTBot::FILE *) fopen("../../../tests/src/A", "w");

    int actual = help(file);
    EXPECT_EQ(-1, actual);
}

In case ferror check is removed then proper test is generated and passes.

tyuldashev avatar Nov 29 '22 15:11 tyuldashev