Skip to content

Cannot run test generated for function with parameter named after C++ keyword #534

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

Open
tyuldashev opened this issue Nov 11, 2022 · 0 comments
Labels
bug Something isn't working wrong generation Inadequate or empty test suite generated

Comments

@tyuldashev
Copy link
Collaborator

Description
It seems that some C++ keywords cannot be used as parameter names in C functions, because generated tests cannot be run. For instance and, and_eq or bitand and probably others.

To Reproduce

Generate tests for following function and try to run them:

int param_name_and(int and) {
    return and * and;
}

Expected behavior
Tests are generated and executed.

Actual behavior
Tests are generated but execution fails. Following error could be found in the logs:

In file included from /home/utbot/remote/SampleDocker2/tests/makefiles/src/../../../tests/src/params_dot_c_test.cpp:5:
/home/utbot/remote/SampleDocker2/tests/makefiles/src/../../../tests/src/params_dot_c_test.h:65:39: error: expected identifier
return param_name_and_src_params_c(and);

params_dot_c_test.h

...
extern "C" int param_name_and_src_params_c(int and);
static int param_name_and(int and) {
return param_name_and_src_params_c(and);
}
...

Additional context
To verify other keywords please use attached file, rename extension to c and probably comment out param_name_wchar_t function as it seems separate problem. Then generate and run tests.

params.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wrong generation Inadequate or empty test suite generated
Projects
Status: Todo
Development

No branches or pull requests

1 participant