Support incomplete types
Steps to reproduce
- Open and configure project
coreutils - Choose target
libcoreutils.a - Generate tests for function di_set_free from
gnulib/lib/di-set.c - See generated tests.
Current result
Currently tests generated by UTBotCpp looks like the following:
TEST(error, di_set_free_test_1)
{
struct di_set dis = {(struct hash_table *) 0xffffffc0, (struct ino_map *) 0xffffffff, (struct di_ent *) 0xffffffff};
di_set_free(&dis);
struct di_set expected_dis = {NULL, NULL, NULL};
}
TEST(error, di_set_free_test_2)
{
struct di_set dis = {NULL, NULL, NULL};
di_set_free(&dis);
struct di_set expected_dis = {NULL, NULL, NULL};
}
Expected result
We would like UTBotCpp to generate tests that creates hash_table, ino_map and di_ent and passes pointers to them to di_set dis which is then used as an argument for di_set_free.
The main problem is that hash_table structure is declared in "hash.h" file but defined in "hash.c".
To learn more about the issue see: https://github.com/UnitTestBot/UTBotCpp/issues/154
Instead of coreutils you can reproduce this case using UTBotCpp unit tests.
Steps to reproduce
- Open and configure project
server/test/suites/regression - Generate tests for
sum_double_pairsfunction from filePR-200/PR-200.cpp - See generated tests
Current result
TEST(regression, sum_double_pairs_test_1)
{
struct double_pair p = {NULL, NULL};
int actual = sum_double_pairs(&p);
EXPECT_EQ(0, actual);
struct double_pair expected_p = {NULL, NULL};
}
TEST(error, sum_double_pairs_test_2)
{
struct double_pair p = {(struct pair *) 0xff, NULL};
sum_double_pairs(&p);
struct double_pair expected_p = {NULL, NULL};
}
Expected result
We would like UTBotCpp to generate tests that creates two structs pair and passes pointers to them to double_pair which is then used as an argument for sum_double_pairs.
The main problem is that pair structure is declared in "pair.h" file but defined in "pair.c".