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

Conditional (ternary) operator support [C standard test] #324

Closed
belous-dp opened this issue Jul 14, 2022 · 1 comment
Closed

Conditional (ternary) operator support [C standard test] #324

belous-dp opened this issue Jul 14, 2022 · 1 comment
Assignees
Labels
bug Something isn't working c-syntax Related to generation tests for C klee Related to internal work of KLEE

Comments

@belous-dp
Copy link
Collaborator

belous-dp commented Jul 14, 2022

Description
Add conditional (ternary) operator ? : support.

Current behavior
Source code:

int ternary_positive(int n) {
    int res = n >= 0 ? 1 : 0;
    return res;
}

int ternary_sign(int n) {
    return (n > 0 ? 1 : (n < 0 ? -1 : 0));
}

Generated tests:

TEST(regression, ternary_positive_test_1)
{
    int actual = ternary_positive(-1);
    EXPECT_EQ(0, actual);
}

TEST(regression, ternary_sign_test_1)
{
    int actual = ternary_sign(0);
    EXPECT_EQ(0, actual);
}

TEST(regression, ternary_sign_test_2)
{
    int actual = ternary_sign(1);
    EXPECT_EQ(1, actual);
}

Expected behavior
More tests generated. The following tests should be generated:

TEST(regression, ternary_positive_test_2)
{
    int actual = ternary_positive(0);
    EXPECT_EQ(1, actual);
}

TEST(regression, ternary_sign_test_2)
{
    int actual = ternary_sign(-1);
    EXPECT_EQ(-1, actual);
}
@belous-dp belous-dp added the enhancement New feature or request label Jul 14, 2022
@korifey korifey moved this to Todo in UTBot C/C++ Jul 14, 2022
@Lana243 Lana243 added bug Something isn't working and removed enhancement New feature or request labels Jul 15, 2022
@belous-dp belous-dp changed the title Conditional (ternary) operator support Conditional (ternary) operator support [C standard test] Jul 15, 2022
@ladisgin ladisgin added c-syntax Related to generation tests for C klee Related to internal work of KLEE labels Aug 26, 2022
@ladisgin
Copy link
Member

ladisgin commented Mar 9, 2023

Moved to UnitTestBot/klee#65

@ladisgin ladisgin closed this as completed Mar 9, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in UTBot C/C++ Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c-syntax Related to generation tests for C klee Related to internal work of KLEE
Projects
Status: Done
Development

No branches or pull requests

4 participants