We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
GET_ARGS_FIRST_N
1 parent 7250903 commit 2089193Copy full SHA for 2089193
tests/unit/util/main.c
@@ -461,6 +461,28 @@ ZTEST(util, test_GET_ARGS_LESS_N) {
461
zassert_equal(c[0], 3);
462
}
463
464
+ZTEST(util, test_GET_ARGS_FIRST_N)
465
+{
466
+ uint8_t a[] = {GET_ARGS_FIRST_N(0, 1, 2, 3)};
467
+ uint8_t b[] = {GET_ARGS_FIRST_N(1, 1, 2, 3)};
468
+ uint8_t c[] = {GET_ARGS_FIRST_N(2, 1, 2, 3)};
469
+ uint8_t d[] = {GET_ARGS_FIRST_N(3, 1, 2, 3)};
470
+
471
+ zassert_equal(sizeof(a), 0);
472
473
+ zassert_equal(sizeof(b), 1);
474
+ zassert_equal(b[0], 1);
475
476
+ zassert_equal(sizeof(c), 2);
477
+ zassert_equal(c[0], 1);
478
+ zassert_equal(c[1], 2);
479
480
+ zassert_equal(sizeof(d), 3);
481
+ zassert_equal(d[0], 1);
482
+ zassert_equal(d[1], 2);
483
+ zassert_equal(d[2], 3);
484
+}
485
486
ZTEST(util, test_mixing_GET_ARG_and_FOR_EACH) {
487
#undef TEST_MACRO
488
#define TEST_MACRO(x) x,
0 commit comments