bitfield: add tests

Add tests for the bitfield helpers. The constant ones will all
be folded to nothing by the compiler (if everything is correct
in the header file), and the variable ones do some tests against
open-coding the necessary shifts.

A few test cases that should fail/warn compilation are provided
under ifdef.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Johannes Berg
2018-06-20 08:58:30 +02:00
committed by Kalle Valo
parent 37a3862e12
commit 0e2dc70e3d
3 changed files with 176 additions and 0 deletions

View File

@@ -1802,6 +1802,13 @@ config TEST_BITMAP
If unsure, say N.
config TEST_BITFIELD
tristate "Test bitfield functions at runtime"
help
Enable this option to test the bitfield functions at boot.
If unsure, say N.
config TEST_UUID
tristate "Test functions located in the uuid module at runtime"