UTBotCpp icon indicating copy to clipboard operation
UTBotCpp copied to clipboard

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

Open tyuldashev opened this issue 3 years ago • 0 comments

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

tyuldashev avatar Nov 11 '22 13:11 tyuldashev