mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: I Hsin Cheng <richard120310@gmail.com>
To: davidgow@google.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	I Hsin Cheng <richard120310@gmail.com>
Subject: [RESEND PATCH v4] list: test: Check the size of every lists for list_cut_position*()
Date: Tue,  8 Oct 2024 14:51:23 +0800	[thread overview]
Message-ID: <20241008065123.26422-1-richard120310@gmail.com> (raw)

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. wo additional elements in the second list would not have been
caught.

Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
change in v4:
	Amend the description of commit message, make it less confusing
	and focus on the correct check which is performed now.

 lib/list-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/list-test.c b/lib/list-test.c
index 37cbc33e9fdb..b4b3810c71d0 100644
--- a/lib/list-test.c
+++ b/lib/list-test.c
@@ -408,6 +408,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)
@@ -436,6 +438,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)
-- 
2.43.0


             reply	other threads:[~2024-10-08  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08  6:51 I Hsin Cheng [this message]
2024-10-08  7:29 ` Kuan-Wei Chiu
2024-10-08  6:52 I Hsin Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241008065123.26422-1-richard120310@gmail.com \
    --to=richard120310@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®