From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()
Date: Wed, 1 Oct 2014 08:33:44 -0400 [thread overview]
Message-ID: <20141001123343.GA10772@peff.net> (raw)
In-Reply-To: <542BE114.9070300@web.de>
On Wed, Oct 01, 2014 at 01:10:12PM +0200, René Scharfe wrote:
> >I wonder if it is worth adding a test (you test only that "not found"
> >produces a negative index, but not which index). Like:
>
> api-sha1-array.txt says about sha1_array_lookup: "If not found, returns a
> negative integer", and that's what the test checks.
Hmm. I do not recall intentionally leaving the value unspecified; I
think it is more that I was simply not thorough when writing the
documentation. That being said...
> I actually like that the value is not specified for that case because no
> existing caller actually uses it and it leaves room to implement the
> function e.g. using bsearch(3).
Yeah, if no callers actually care right now, that is a reasonable
argument for leaving the exact return value unspecified (and testing
only what the documentation claims).
> I agree that adding a "lookup non-existing entry with duplicates" test would
> make t0064 more complete, though.
Agreed.
-Peff
next prev parent reply other threads:[~2014-10-01 12:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 9:40 [PATCH 1/2] sha1-array: add test-sha1-array and basic tests René Scharfe
2014-10-01 9:43 ` [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos() René Scharfe
2014-10-01 10:50 ` Jeff King
2014-10-01 11:10 ` René Scharfe
2014-10-01 12:33 ` Jeff King [this message]
2014-10-01 14:12 ` Eric Sunshine
2014-10-01 14:11 ` [PATCH 1/2] sha1-array: add test-sha1-array and basic tests Eric Sunshine
2014-10-01 14:21 ` René Scharfe
2014-10-01 14:23 ` Jeff King
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=20141001123343.GA10772@peff.net \
--to=peff@peff.net \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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;
as well as URLs for NNTP newsgroup(s).