Skip to content

Commit f5379a0

Browse files
JoseExpositoJiri Kosina
authored andcommitted
HID: uclogic: Use KUNIT_EXPECT_MEMEQ
Commit b8a926b ("kunit: Introduce KUNIT_EXPECT_MEMEQ and KUNIT_EXPECT_MEMNEQ macros") introduced a new macro to compare blocks of memory and, if the test fails, print the result in a human friendly format. For example, this is the output of a test failure: Expected res == params->expected, but res == 01 02 aa 00 00 00 03 bb 00 <00> 00 04 05 params->expected == 01 02 aa 00 00 00 03 bb 00 <01> 00 04 05 Use this new macro to replace KUNIT_EXPECT_EQ + memcmp. Signed-off-by: José Expósito <[email protected]> Reviewed-by: Maíra Canal <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 9266a88 commit f5379a0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/hid/hid-uclogic-rdesc-test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ static void hid_test_uclogic_template(struct kunit *test)
197197
params->param_list,
198198
params->param_num);
199199
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, res);
200-
KUNIT_EXPECT_EQ(test, 0,
201-
memcmp(res, params->expected, params->template_size));
200+
KUNIT_EXPECT_MEMEQ(test, res, params->expected, params->template_size);
202201
kfree(res);
203202
}
204203

0 commit comments

Comments
 (0)