Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/unit/util/test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ void test_UTIL_LISTIFY(void)
{
int i = 0;

#define INC(x, _) \
#define INC(x, n, m) \
do { \
i += x; \
i += (x + n + m);\
} while (0);

#define DEFINE(x, y) int a##x = x * y;
Expand All @@ -177,9 +177,9 @@ void test_UTIL_LISTIFY(void)
UTIL_LISTIFY(4, DEFINE, 2)
UTIL_LISTIFY(4, MARK_UNUSED, _)

UTIL_LISTIFY(4, INC, _)
UTIL_LISTIFY(4, INC, 1, 2)

zassert_equal(i, 0 + 1 + 2 + 3, NULL);
zassert_equal(i, 0 + 1 + 2 + 3 + 4 * (1 + 2), NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a little more clear expressed as:

zassert_equal(i, (0 + 1 + 2) + (1 + 1 + 2) + (2 + 1 + 2) + (3 + 1 + 2), NULL);

since that represents the effect of the four calls.

zassert_equal(a0, 0, NULL);
zassert_equal(a1, 2, NULL);
zassert_equal(a2, 4, NULL);
Expand Down