Messages in this thread | | | From | Daniel Latypov <> | Date | Tue, 2 Aug 2022 12:56:30 -0700 | Subject | Re: [PATCH 2/3] kunit: add KUnit array assertions to the example_all_expect_macros_test |
| |
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
| |