lib/math: Add int_sqrt test suite
Subsystems (2)
PATCH 1/1 lib/math: Add int_sqrt test suite
Adds test suite for integer based square root function.
The test suite is designed to verify the correctness of the int_sqrt math library function.
Signed-off-by Luis Felipe Hernandez <[email protected]>
--- lib/Kconfig.debug | 17 ++++++++++++ lib/math/Makefile | 1 + lib/math/tests/Makefile | 1 + lib/math/tests/int_sqrt_kunit.c | 48 +++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 lib/math/tests/int_sqrt_kunit.c
lib/Kconfig.debug +17 -0
@@ -2993,6 +2993,23 @@ config TEST_OBJPOOL If unsure, say N. +config INT_SQRT_KUNIT_TEST + tristate "Integer square root test test" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + This option enables the KUnit test suite for the int_sqrt function, + which performs square root calculation. The test suite is designed to + verify that the implementation of int_sqrt correctly computes the + square root of a number. + + Enabling this option will include tests that check various scenarios + and edge cases to ensure the accuracy and reliability of the square root + function. + + If unsure, say N + + endif # RUNTIME_TESTING_MENU config ARCH_USE_MEMTEST
lib/math/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_INT_POW_TEST) += tests/int_pow_kunit.o obj-$(CONFIG_TEST_DIV64) += test_div64.o obj-$(CONFIG_TEST_MULDIV64) += test_mul_u64_u64_div_u64.o obj-$(CONFIG_RATIONAL_KUNIT_TEST) += rational-test.o +obj-y += tests/
lib/math/tests/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_INT_POW_TEST) += int_pow_kunit.o +obj-$(CONFIG_INT_SQRT_KUNIT_TEST) += int_sqrt_kunit.o
lib/math/tests/int_sqrt_kunit.c new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.47.0
Quoted 4 lines · Luis Felipe Hernandez
Adds test suite for integer based square root function.
The test suite is designed to verify the correctness of the
int_sqrtmath library function.
...
Quoted 5 lines
obj-$(CONFIG_TEST_DIV64) += test_div64.o
obj-$(CONFIG_TEST_MULDIV64) += test_mul_u64_u64_div_u64.o
obj-$(CONFIG_RATIONAL_KUNIT_TEST) += rational-test.o
+obj-y += tests/
\ No newline at end of file
^^^ Please, fix this.
...
Quoted 1 line
+#include <
kunit/test.h>
+ limits.h
Quoted 1 line
+#include <
linux/math.h>
+ module.h
+ string.h
Signature · 2 lines
With Best Regards, Andy Shevchenko