tests: unit: util: Add test for LISTIFY

Add test for LISTIFY macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-02-28 11:53:49 +01:00 committed by Carles Cufí
parent 787fa61efd
commit 9b30b959d5

View file

@ -186,6 +186,19 @@ void test_UTIL_LISTIFY(void)
zassert_equal(a3, 6, NULL);
}
void test_LISTIFY(void)
{
int ab0 = 1;
int ab1 = 1;
#define A_PTR(x, name0, name1) &UTIL_CAT(UTIL_CAT(name0, name1), x)
int *a[] = { LISTIFY(2, A_PTR, (,), a, b) };
zassert_equal(ARRAY_SIZE(a), 2, NULL);
zassert_equal(a[0], &ab0, NULL);
zassert_equal(a[1], &ab1, NULL);
}
void test_MACRO_MAP_CAT(void)
{
int item_a_item_b_item_c_ = 1;
@ -461,6 +474,7 @@ void test_cc(void)
ztest_unit_test(test_UTIL_AND),
ztest_unit_test(test_IF_ENABLED),
ztest_unit_test(test_UTIL_LISTIFY),
ztest_unit_test(test_LISTIFY),
ztest_unit_test(test_MACRO_MAP_CAT),
ztest_unit_test(test_z_max_z_min_z_clamp),
ztest_unit_test(test_CLAMP),