On Tue, Aug 2, 2022 at 12:00 PM MaĆra Canal mairacanal@riseup.net wrote:
I don't know how we make a maximally fool-proof version of this macro :\
This is a hard one also. I believe that use KUNIT_EXPECT_ARREQ(test, expected, expected, sizeof(expected)); is more compliant to the memcpy/memset/memcmp signature. Moreover, this problem also occur for the KUNIT_EXPECT_EQ(test, memcmp(expected, expected, sizeof(expected)), 0);
I believe that the number of array elements will make it easier for users to avoid mistakes.
Actually, another idea: perhaps KUNIT_EXPECT_MEMEQ? I think that might be clearer in terms of the semantics and people could more easily infer the right unit (bytes).
Daniel