Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Depending on verbose setting 'FAIL()' is added to the error test or not #472

Closed
tyuldashev opened this issue Sep 23, 2022 · 0 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers verified Bug fix is verified wrong generation Inadequate or empty test suite generated

Comments

@tyuldashev
Copy link
Collaborator

To Reproduce
Generate test for following code

int div(int a, int b) {
  return a / b;
}

Actual behavior
When Verbose setting is enabled following error test is generated

TEST(error, div_test_2)
{
    // Construct input
    int a = 0;
    int b = 0;

    // Trigger the function
    div(a, b);

    FAIL() << "Unreachable point. Function was supposed to fail, but actually completed successfully.";
}

When Verbose is disabled then:

TEST(error, div_test_2)
{
    div(0, 0);
}

As result depending on verbose setting test behaves completely differently.

Expected

UTBot either adds FAIL() at the end of the test in both situations or doesn't add it not matter what state of Verbose setting is.

@tyuldashev tyuldashev added bug Something isn't working wrong generation Inadequate or empty test suite generated labels Sep 23, 2022
@tyuldashev tyuldashev moved this to Todo in UTBot C/C++ Sep 23, 2022
@alexey-utkin alexey-utkin moved this from Todo to In Progress in UTBot C/C++ Sep 28, 2022
@alexey-utkin alexey-utkin added the good first issue Good for newcomers label Sep 30, 2022
elenaboldyreva added a commit that referenced this issue Nov 1, 2022
Add FAIL() assertion to generated tests in no verbose mode.
The line with FAIL() assertion is unreachable in some tests but it gives
additional information to the user to make the tests easier to read.

I add a unit test to check that the code of generated tests (error suit) has
the line with FAIL() assertion. I decided not to use statuses from the tests
execution because the line with FAIL() assertion can be unreachable.

Refs: #472
elenaboldyreva added a commit that referenced this issue Nov 3, 2022
Add FAIL() assertion to generated tests in no verbose mode.
The line with FAIL() assertion is unreachable in some tests but it gives
additional information to the user to make the tests easier to read.

I add a unit test to check that the code of generated tests (error suit) has
the line with FAIL() assertion. I decided not to use statuses from the tests
execution because the line with FAIL() assertion can be unreachable.

Refs: #472
Repository owner moved this from In Progress to Done in UTBot C/C++ Nov 3, 2022
@tyuldashev tyuldashev added the verified Bug fix is verified label Nov 18, 2022
Lana243 pushed a commit that referenced this issue Nov 21, 2022
Add FAIL() assertion to generated tests in no verbose mode.
The line with FAIL() assertion is unreachable in some tests but it gives
additional information to the user to make the tests easier to read.

I add a unit test to check that the code of generated tests (error suit) has
the line with FAIL() assertion. I decided not to use statuses from the tests
execution because the line with FAIL() assertion can be unreachable.

Refs: #472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers verified Bug fix is verified wrong generation Inadequate or empty test suite generated
Projects
Status: Done
Development

No branches or pull requests

3 participants