Skip to content

Commit 145b120

Browse files
author
thk123
committed
Adding regression test for typedef'd structs
Bug outlined in diffblue#315
1 parent 140fc2d commit 145b120

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

regression/test-c-gen/struct3/main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdbool.h>
2+
3+
typedef struct
4+
{
5+
bool b;
6+
int x;
7+
} example_s;
8+
9+
void fun(example_s struct_param)
10+
{
11+
if(!struct_param.b)
12+
{
13+
}
14+
if(struct_param.x > 0)
15+
{
16+
struct_param.b = false;
17+
}
18+
19+
if(struct_param.b)
20+
{
21+
}
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
CORE
2+
main.c
3+
--function fun --cover branch --gen-c-test-case
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^#include <assert\.h>$
7+
^#include <stdio\.h>$
8+
^#include <stdlib\.h>$
9+
10+
^#include "main\.c"$
11+
^int test_main(int argc, char\* argv)$
12+
^\{$
13+
^ example_s arg_fun_struct_param = { \.b=1, \.x=-2147483648 };$
14+
^ example_s arg_fun_struct_param = { \.b=0, \.x=-2147483648 };$
15+
^ example_s arg_fun_struct_param = { \.b=0, \.x=1 };$
16+
^ fun(arg_fun_struct_param);$
17+
^ exit(0);$
18+
^ return 0;$
19+
^\}$
20+
21+
22+
--
23+
^warning: ignoring

0 commit comments

Comments
 (0)