Skip to content

Commit

Permalink
list: test: check the size of every lists for list_cut_position*()
Browse files Browse the repository at this point in the history
Check the total number of elements in both resultant lists are correct
within list_cut_position*().  Previously, only the first list's size was
checked.  so additional elements in the second list would not have been
caught.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: I Hsin Cheng <[email protected]>
Cc: David Gow <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
vax-r authored and akpm00 committed Nov 6, 2024
1 parent b421664 commit 5a3c936
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/list-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ static void list_test_list_cut_position(struct kunit *test)
KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
i++;
}

KUNIT_EXPECT_EQ(test, i, 3);
}

static void list_test_list_cut_before(struct kunit *test)
Expand Down Expand Up @@ -440,6 +442,8 @@ static void list_test_list_cut_before(struct kunit *test)
KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
i++;
}

KUNIT_EXPECT_EQ(test, i, 3);
}

static void list_test_list_splice(struct kunit *test)
Expand Down

0 comments on commit 5a3c936

Please sign in to comment.