File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ ZTEST(util_cxx, test_IF_ENABLED) {
3838 run_IF_ENABLED ();
3939}
4040
41+ ZTEST (util_cxx , test_IF_DISABLED ) {
42+ run_IF_DISABLED ();
43+ }
44+
4145ZTEST (util_cxx , test_LISTIFY ) {
4246 run_LISTIFY ();
4347}
@@ -186,6 +190,10 @@ ZTEST(util_cc, test_IF_ENABLED) {
186190 run_IF_ENABLED ();
187191}
188192
193+ ZTEST (util_cc , test_IF_DISABLED ) {
194+ run_IF_DISABLED ();
195+ }
196+
189197ZTEST (util_cc , test_LISTIFY ) {
190198 run_LISTIFY ();
191199}
Original file line number Diff line number Diff line change @@ -162,6 +162,28 @@ skipped:
162162 #undef test_IF_ENABLED_FLAG_B
163163}
164164
165+ void run_IF_DISABLED (void )
166+ {
167+ #define test_IF_DISABLED_FLAG_A 0
168+ #define test_IF_DISABLED_FLAG_B 1
169+
170+ IF_DISABLED (test_IF_DISABLED_FLAG_A, (goto skipped_a;))
171+ /* location should be skipped if IF_DISABLED macro is correct. */
172+ zassert_false (true , " location A should be skipped" );
173+ skipped_a:
174+ IF_DISABLED (test_IF_DISABLED_FLAG_B, (zassert_false (true , " " );))
175+
176+ IF_DISABLED (test_IF_DISABLED_FLAG_C, (goto skipped_c;))
177+ /* location should be skipped if IF_DISABLED macro is correct. */
178+ zassert_false (true , " location C should be skipped" );
179+ skipped_c:
180+
181+ zassert_true (true , " " );
182+
183+ #undef test_IF_DISABLED_FLAG_A
184+ #undef test_IF_DISABLED_FLAG_B
185+ }
186+
165187void run_LISTIFY (void )
166188{
167189 int ab0 = 1 ;
You can’t perform that action at this time.
0 commit comments