Skip to content

Commit

Permalink
tests: unit: util: Add test for REVERSE_ARGS
Browse files Browse the repository at this point in the history
Added test for new macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
  • Loading branch information
nordic-krch authored and carlescufi committed Feb 23, 2021
1 parent de84575 commit 9d33265
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/unit/util/test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@ static void test_mixing_GET_ARG_and_FOR_EACH(void)
zassert_equal(a[4], 5, NULL);
}

static void test_REVERSE_ARGS(void)
{
int y[] = {REVERSE_ARGS(1, 2, 3)};

zassert_equal(y[0], 3, NULL);
zassert_equal(y[1], 2, NULL);
zassert_equal(y[2], 1, NULL);
}

#if __cplusplus
extern "C" void test_cxx(void);
void test_cxx(void)
Expand Down Expand Up @@ -470,7 +479,8 @@ void test_cc(void)
ztest_unit_test(test_nested_FOR_EACH),
ztest_unit_test(test_GET_ARG_N),
ztest_unit_test(test_GET_ARGS_LESS_N),
ztest_unit_test(test_mixing_GET_ARG_and_FOR_EACH)
ztest_unit_test(test_mixing_GET_ARG_and_FOR_EACH),
ztest_unit_test(test_REVERSE_ARGS)
);

ztest_run_test_suite(test_lib_sys_util_tests);
Expand Down

0 comments on commit 9d33265

Please sign in to comment.