All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Seyi Kuforiji <kuforiji98@gmail.com>
Cc: git@vger.kernel.org, phillip.wood@dunelm.org.uk
Subject: Re: [PATCH 4/4] t/unit-tests: convert strcmp-offset test to clar framework
Date: Fri, 31 Jan 2025 12:44:03 +0100	[thread overview]
Message-ID: <Z5y3gwWwLFlHiLkj@pks.im> (raw)
In-Reply-To: <20250130091334.39922-5-kuforiji98@gmail.com>

On Thu, Jan 30, 2025 at 10:13:34AM +0100, Seyi Kuforiji wrote:
> Adapt strcmp-offset test script to clar framework by using clar
> assertions where necessary. Test functions are created as standalone to
> test different test cases.

Same comment here regarding the message.

> diff --git a/t/unit-tests/u-strcmp-offset.c b/t/unit-tests/u-strcmp-offset.c
> new file mode 100644
> index 0000000000..7e8e9acf3c
> --- /dev/null
> +++ b/t/unit-tests/u-strcmp-offset.c
> @@ -0,0 +1,45 @@
> +#include "unit-test.h"
> +#include "read-cache-ll.h"
> +
> +static void check_strcmp_offset(const char *string1, const char *string2,
> +				int expect_result, uintmax_t expect_offset)
> +{
> +	size_t offset;
> +	int result = strcmp_offset(string1, string2, &offset);
> +
> +	/*
> +	 * Because different CRTs behave differently, only rely on signs of the
> +	 * result values.
> +	 */
> +	result = (result < 0 ? -1 :
> +			result > 0 ? 1 :
> +			0);
> +
> +	cl_assert_equal_i(result, expect_result);
> +	cl_assert_equal_i((uintmax_t)offset, expect_offset);
> +}
> +
> +void test_strcmp_offset__empty(void)
> +{
> +	check_strcmp_offset("", "", 0, 0);

This test didn't exist in the preimage, right? I don't mind adding it,
but it is somewhat surprising as the commit message does not mention
this at all.

Patrick

  reply	other threads:[~2025-01-31 11:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30  9:13 [PATCH 0/4] t/unit-tests: convert unit-tests to use clar Seyi Kuforiji
2025-01-30  9:13 ` [PATCH 1/4] t/unit-tests: convert hashmap test to clar framework Seyi Kuforiji
2025-01-31 11:43   ` Patrick Steinhardt
2025-01-30  9:13 ` [PATCH 2/4] t/unit-tests: adapt example decorate " Seyi Kuforiji
2025-01-31 11:43   ` Patrick Steinhardt
2025-01-30  9:13 ` [PATCH 3/4] t/unit-tests: convert strbuf " Seyi Kuforiji
2025-01-31 11:43   ` Patrick Steinhardt
2025-01-30  9:13 ` [PATCH 4/4] t/unit-tests: convert strcmp-offset " Seyi Kuforiji
2025-01-31 11:44   ` Patrick Steinhardt [this message]
2025-01-31 11:43 ` [PATCH 0/4] t/unit-tests: convert unit-tests to use clar Patrick Steinhardt
2025-01-31 22:14 ` [PATCH v2 " Seyi Kuforiji
2025-01-31 22:14   ` [PATCH v2 1/4] t/unit-tests: convert hashmap test to use clar test framework Seyi Kuforiji
2025-01-31 23:03     ` Junio C Hamano
2025-02-02 11:09     ` phillip.wood123
2025-02-03  7:30       ` Patrick Steinhardt
2025-02-03 14:56         ` phillip.wood123
2025-01-31 22:14   ` [PATCH v2 2/4] t/unit-tests: adapt example decorate " Seyi Kuforiji
2025-01-31 22:14   ` [PATCH v2 3/4] t/unit-tests: convert strbuf " Seyi Kuforiji
2025-02-02 14:38     ` Phillip Wood
2025-01-31 22:14   ` [PATCH v2 4/4] t/unit-tests: convert strcmp-offset " Seyi Kuforiji
2025-01-31 23:06   ` [PATCH v2 0/4] t/unit-tests: convert unit-tests to use clar Junio C Hamano

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=Z5y3gwWwLFlHiLkj@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=kuforiji98@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.