All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Cc: git@vger.kernel.org,  christian.couder@gmail.com,
	 Christian Couder <chriscool@tuxfamily.org>,
	 Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Subject: Re: [GSoC][PATCH v2] t/: migrate helper/test-oidtree.c to unit-tests/t-oidtree.c
Date: Mon, 10 Jun 2024 09:40:16 -0700	[thread overview]
Message-ID: <xmqqed944uq7.fsf@gitster.g> (raw)
In-Reply-To: <20240608165731.29467-1-shyamthakkar001@gmail.com> (Ghanshyam Thakkar's message of "Sat, 8 Jun 2024 22:27:09 +0530")

Ghanshyam Thakkar <shyamthakkar001@gmail.com> writes:

> helper/test-oidtree.c along with t0069-oidtree.sh test the oidtree.h
> library, which is a wrapper around crit-bit tree. Migrate them to
> the unit testing framework for better debugging and runtime
> performance. Along with the migration, add an extra check for
> oidtree_each() test, which showcases how multiple expected matches can
> be given to check_each() helper.
> ...

Use "LAST_ARG_MUST_BE_NULL" here, probably.
> +static void check_each(struct oidtree *ot, char *query, ...)
> +{
> +	struct object_id oid;
> +	struct expected_hex_iter hex_iter = { .expected_hexes = STRVEC_INIT,
> ...
> +static void t_each(struct oidtree *ot)
> +{
> +	FILL_TREE(ot, "f", "9", "8", "123", "321", "320", "a", "b", "c", "d", "e");
> +	check_each(ot, "12300", "123", NULL);
> +	check_each(ot, "3211", NULL); /* should not reach callback */

This one truly checks that the callback is never called with this
version, which is way better than the previous one (or the
original).

> +	check_each(ot, "3210", "321", NULL);
> +	check_each(ot, "32100", "321", NULL);
> +	check_each(ot, "32", "320", "321", NULL);
> +}
> +
> +int cmd_main(int argc UNUSED, const char **argv UNUSED)
> +{
> +	TEST(setup(t_contains), "oidtree insert and contains works");
> +	TEST(setup(t_each), "oidtree each works");
> +	return test_done();
> +}

  reply	other threads:[~2024-06-10 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 13:43 [GSoC][PATCH] t/: migrate helper/test-oidtree.c to unit-tests/t-oidtree.c Ghanshyam Thakkar
2024-06-06 21:54 ` Junio C Hamano
2024-06-06 23:35   ` Ghanshyam Thakkar
2024-06-07  8:31     ` Christian Couder
2024-06-07  8:36       ` Christian Couder
2024-06-07  8:41         ` Christian Couder
2024-06-07 16:37     ` Junio C Hamano
2024-06-08 16:57 ` [GSoC][PATCH v2] " Ghanshyam Thakkar
2024-06-10 16:40   ` Junio C Hamano [this message]
2024-06-10 20:52     ` Ghanshyam Thakkar
2024-06-10 21:06       ` Junio C Hamano
2024-06-10 22:01         ` Ghanshyam Thakkar
2024-06-10 23:20           ` Junio C Hamano
2024-06-10 23:36             ` Ghanshyam Thakkar

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=xmqqed944uq7.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=shyamthakkar001@gmail.com \
    /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.