lib: packing: add additional KUnit tests
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 2 Oct 2024 21:51:56 +0000 (14:51 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Oct 2024 22:32:04 +0000 (15:32 -0700)
commitfcd6dd91d0e8b151210c9532309e451c12e386e1
treeeaabc32c2c24b7dec2676fe85e815910b6276c25
parente9502ea6db8a457f0bc28a4a1f03517ad0547911
lib: packing: add additional KUnit tests

While reviewing the initial KUnit tests for lib/packing, Przemek pointed
out that the test values have duplicate bytes in the input sequence.

In addition, I noticed that the unit tests pack and unpack on a byte
boundary, instead of crossing bytes. Thus, we lack good coverage of the
corner cases of the API.

Add additional unit tests to cover packing and unpacking byte buffers which
do not have duplicate bytes in the unpacked value, and which pack and
unpack to an unaligned offset.

A careful reviewer may note the lack tests for QUIRK_MSB_ON_THE_RIGHT. This
is because I found issues with that quirk during test implementation. This
quirk will be fixed and the tests will be included in a future change.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241002-packing-kunit-tests-and-split-pack-unpack-v2-7-8373e551eae3@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
lib/packing_test.c