Re: [PATCH 2/3] kunit: add KUnit array assertions to the example_all_expect_macros_test

From: Daniel Latypov
Date: Tue Aug 02 2022 - 15:56:49 EST


On Tue, Aug 2, 2022 at 12:00 PM Maíra Canal <mairacanal@xxxxxxxxxx> 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