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 e09c8fb commit 1c6134aCopy full SHA for 1c6134a
tests/unit/util/main.c
@@ -527,6 +527,28 @@ ZTEST(util, test_GET_ARGS_LESS_N) {
527
zassert_equal(c[0], 3);
528
}
529
530
+ZTEST(util, test_GET_ARGS_FIRST_N)
531
+{
532
+ uint8_t a[] = {GET_ARGS_FIRST_N(0, 1, 2, 3)};
533
+ uint8_t b[] = {GET_ARGS_FIRST_N(1, 1, 2, 3)};
534
+ uint8_t c[] = {GET_ARGS_FIRST_N(2, 1, 2, 3)};
535
+ uint8_t d[] = {GET_ARGS_FIRST_N(3, 1, 2, 3)};
536
+
537
+ zassert_equal(sizeof(a), 0);
538
539
+ zassert_equal(sizeof(b), 1);
540
+ zassert_equal(b[0], 1);
541
542
+ zassert_equal(sizeof(c), 2);
543
+ zassert_equal(c[0], 1);
544
+ zassert_equal(c[1], 2);
545
546
+ zassert_equal(sizeof(d), 3);
547
+ zassert_equal(d[0], 1);
548
+ zassert_equal(d[1], 2);
549
+ zassert_equal(d[2], 3);
550
+}
551
552
ZTEST(util, test_mixing_GET_ARG_and_FOR_EACH) {
553
#undef TEST_MACRO
554
#define TEST_MACRO(x) x,
0 commit comments