diff options
Diffstat (limited to 'lib/test_sort.c')
-rw-r--r-- | lib/test_sort.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/test_sort.c b/lib/test_sort.c index be02e3a098cf..cd4a338d1153 100644 --- a/lib/test_sort.c +++ b/lib/test_sort.c @@ -29,7 +29,19 @@ static void test_sort(struct kunit *test) sort(a, TEST_LEN, sizeof(*a), cmpint, NULL); - for (i = 0; i < TEST_LEN-1; i++) + for (i = 0; i < TEST_LEN - 1; i++) + KUNIT_ASSERT_LE(test, a[i], a[i + 1]); + + r = 48; + + for (i = 0; i < TEST_LEN - 1; i++) { + r = (r * 725861) % 6599; + a[i] = r; + } + + sort(a, TEST_LEN - 1, sizeof(*a), cmpint, NULL); + + for (i = 0; i < TEST_LEN - 2; i++) KUNIT_ASSERT_LE(test, a[i], a[i + 1]); } @@ -45,4 +57,5 @@ static struct kunit_suite sort_test_suite = { kunit_test_suites(&sort_test_suite); +MODULE_DESCRIPTION("sort() KUnit test suite"); MODULE_LICENSE("GPL"); |