UTBotCpp
UTBotCpp copied to clipboard
Cannot run tests for functions with C99 features not permitted in C++ [BUG]
Description If source file contains C99 feature not permitted in C++, then no generated tests can be run.
To Reproduce Steps to reproduce the behavior:
- Generate tests for the following function:
int sum_sign_9_11_static(int a[static 9][11]) {
int sum = 0;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 11; j++) {
sum += a[i][j];
}
}
if (sum == 0) {
return 0;
} else if (sum > 0) {
return 1;
} else {
return -1;
}
}
- Run test:
TEST(error, sum_sign_9_11_static_test_1)
{
int a[2][11] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
sum_sign_9_11_static(a);
}
Expected behavior Generated test runs correctly.
Actual behavior The following error occurred:
static array size is a C99 feature, not permitted in C++
static int sum_sign_9_11_static(int a[static 9][11]) {
Moreover, if there are another correct tested functions in the source file, tests for them also cannot be run as source file cannot be compiled.
Environment UTBotCpp 2022.7.3.