*new* memset: check for memset(x, y, 0); typos
[smatch.git] / validation / sm_select3.c
blob296dd03cd9ccb926e10e63b80e977b447028456a
1 #include "check_debug.h"
3 int a, b, c;
4 int func(void)
6 if (a ? b : c)
7 __smatch_value("a");
9 __smatch_note("Test #1 a ? 1 : c");
10 if (a ? 1 : c) {
11 __smatch_value("a");
12 __smatch_value("c");
13 if (!a)
14 __smatch_value("c");
15 if (!c)
16 __smatch_value("a");
17 } else {
18 __smatch_value("a");
19 __smatch_value("c");
22 __smatch_note("Test #2 a ? 0 : c");
23 if (a ? 0 : c) {
24 __smatch_value("a");
25 __smatch_value("c");
26 if (!a)
27 __smatch_value("c");
28 } else {
29 __smatch_value("a");
30 __smatch_value("c");
31 if (!a)
32 __smatch_value("c");
33 if (!c)
34 __smatch_value("a");
37 __smatch_note("Test #3 a ? b : 1");
38 if (a ? b : 1) {
39 __smatch_value("a");
40 __smatch_value("b");
41 if (!a)
42 __smatch_value("b");
43 if (!b)
44 __smatch_value("a");
45 } else {
46 __smatch_value("a");
47 __smatch_value("b");
48 if (!b)
49 __smatch_value("a");
52 __smatch_note("Test #2 a ? b : 0");
53 if (a ? b : 0) {
54 __smatch_value("a");
55 __smatch_value("b");
56 } else {
57 __smatch_value("a");
58 __smatch_value("b");
59 if (a)
60 __smatch_value("b");
61 if (b)
62 __smatch_value("a");
68 * check-name: Ternary Conditions #3
69 * check-command: smatch -I.. sm_select3.c
71 * check-output-start
72 sm_select3.c +7 func(3) a = min-max
73 sm_select3.c +9 func(5) Test #1 a ? 1 : c
74 sm_select3.c +11 func(7) a = min-max
75 sm_select3.c +12 func(8) c = min-max
76 sm_select3.c +14 func(10) c = min-(-1),1-max
77 sm_select3.c +16 func(12) a = min-(-1),1-max
78 sm_select3.c +18 func(14) a = 0
79 sm_select3.c +19 func(15) c = 0
80 sm_select3.c +22 func(18) Test #2 a ? 0 : c
81 sm_select3.c +24 func(20) a = 0
82 sm_select3.c +25 func(21) c = min-(-1),1-max
83 sm_select3.c +27 func(23) c = min-(-1),1-max
84 sm_select3.c +29 func(25) a = min-max
85 sm_select3.c +30 func(26) c = min-max
86 sm_select3.c +32 func(28) c = 0
87 sm_select3.c +34 func(30) a = min-max
88 sm_select3.c +37 func(33) Test #3 a ? b : 1
89 sm_select3.c +39 func(35) a = min-max
90 sm_select3.c +40 func(36) b = min-max
91 sm_select3.c +42 func(38) b = unknown
92 sm_select3.c +44 func(40) a = 0
93 sm_select3.c +46 func(42) a = min-(-1),1-max
94 sm_select3.c +47 func(43) b = 0
95 sm_select3.c +49 func(45) a = min-(-1),1-max
96 sm_select3.c +52 func(48) Test #2 a ? b : 0
97 sm_select3.c +54 func(50) a = min-(-1),1-max
98 sm_select3.c +55 func(51) b = min-(-1),1-max
99 sm_select3.c +57 func(53) a = min-max
100 sm_select3.c +58 func(54) b = min-max
101 sm_select3.c +60 func(56) b = 0
102 sm_select3.c +62 func(58) a = 0
103 * check-output-end