lib/math: Add Kunit test suite for gcd()

Add a KUnit test suite for the gcd() function.
This test suite verifies the correctness of gcd() across various
scenarios, including edge cases.

Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Link: https://lore.kernel.org/r/20250203075400.3431330-1-eleanor15x@gmail.com
Signed-off-by: Kees Cook <kees@kernel.org>
This commit is contained in:
Yu-Chun Lin
2025-02-03 15:54:00 +08:00
committed by Kees Cook
parent 2be6ce9d9b
commit 9ab61886ac
3 changed files with 70 additions and 0 deletions

View File

@@ -3222,6 +3222,19 @@ config INT_LOG_KUNIT_TEST
If unsure, say N
config GCD_KUNIT_TEST
tristate "Greatest common divisor test" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
This option enables the KUnit test suite for the gcd() function,
which computes the greatest common divisor of two numbers.
This test suite verifies the correctness of gcd() across various
scenarios, including edge cases.
If unsure, say N
endif # RUNTIME_TESTING_MENU
config ARCH_USE_MEMTEST