From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 320FDC433FE for ; Mon, 7 Dec 2020 19:11:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E74C623428 for ; Mon, 7 Dec 2020 19:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726855AbgLGTLe (ORCPT ); Mon, 7 Dec 2020 14:11:34 -0500 Received: from cloud.peff.net ([104.130.231.41]:55242 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgLGTLd (ORCPT ); Mon, 7 Dec 2020 14:11:33 -0500 Received: (qmail 9013 invoked by uid 109); 7 Dec 2020 19:10:53 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 07 Dec 2020 19:10:53 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 25664 invoked by uid 111); 7 Dec 2020 19:10:52 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 07 Dec 2020 14:10:52 -0500 Authentication-Results: peff.net; auth=none Date: Mon, 7 Dec 2020 14:10:52 -0500 From: Jeff King To: git@vger.kernel.org Cc: Derrick Stolee , Eric Sunshine Subject: [PATCH v2 3/9] t0064: make duplicate tests more robust Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Our tests for handling duplicates in oid-array provide only a single duplicate for each number, so our sorted array looks like: 44 44 55 55 88 88 aa aa A slightly more interesting test is to have multiple duplicates, which makes sure that we not only skip the duplicate, but keep skipping until we are out of the set of matching duplicates. Unsurprisingly this works just fine, but it's worth beefing up this test since we're about to change the duplicate-detection code. Note that we do need to adjust the results on the lookup test, since it is returning the index of the found item (and now we have more items before our range, and the range itself is slightly larger, since we'll accept a match of any element). Signed-off-by: Jeff King --- t/t0064-oid-array.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/t/t0064-oid-array.sh b/t/t0064-oid-array.sh index 71034a8007..2e5438ccda 100755 --- a/t/t0064-oid-array.sh +++ b/t/t0064-oid-array.sh @@ -25,6 +25,7 @@ test_expect_success 'ordered enumeration' ' test_expect_success 'ordered enumeration with duplicate suppression' ' echoid "" 44 55 88 aa >expect && { + echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echo for_each_unique @@ -52,17 +53,19 @@ test_expect_success 'lookup non-existing entry' ' test_expect_success 'lookup with duplicates' ' { + echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echoid lookup 55 } | test-tool oid-array >actual && n=$(cat actual) && - test "$n" -ge 2 && - test "$n" -le 3 + test "$n" -ge 3 && + test "$n" -le 5 ' test_expect_success 'lookup non-existing entry with duplicates' ' { + echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echoid append 88 44 aa 55 && echoid lookup 66 -- 2.29.2.980.g762a4e4ed3