Skip to content

ferror confuses UTBot so it creates failing regression test #556

Open
@tyuldashev

Description

@tyuldashev

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwrong generationInadequate or empty test suite generated

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions