Skip to content

Support scanf function #516

Open
Open
@tyuldashev

Description

@tyuldashev

Description
In case code reads user input with scanf UTBot generates wrong regression tests which fails during execution

To Reproduce
Generate tests for following function

int read_with_scanf() {
   int i;

   printf( "Enter a value :");
   scanf("%d", &i);

   return i;
}

Expected behavior
Proper regression tests are generated, which could be successfully executed.

Actual behavior
Generated test fails during execution

TEST(regression, read_with_scanf_test_1)
{
...
    // Expected output
    int expected = -1414812757;

    // Trigger the function
    int actual = read_with_scanf();

    // Check results
    EXPECT_EQ(expected, actual);
}

Additional info
UTBot already supports getchar and getc so expectation is that similar approach could be applied to scanf.

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