From patchwork Sat Mar 16 20:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13594481 Received: from mout.web.de (mout.web.de [212.227.17.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F2701BC37 for ; Sat, 16 Mar 2024 20:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710622739; cv=none; b=prQsZugcVuadKseaQX8IwMGM3pk/z8WgUmbg5Gjokt3LlYRZqGi/ou8Cw2vItBBAoDvirymkGduKO98d/6mKo+k9sltDYfmjvxXpjHxfrOdaPAuM2N3dty0473HclDrexQKYUlfjIB3eHNQdsWAek2YLyZY+8846XVRAA2GCN5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710622739; c=relaxed/simple; bh=CwNS5w8rI7Wf+HLNPMAXZEwpoLgvM98ttPR4jGOLajA=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=gkIEblAuQBcyqis27UDyPgQPK1HOjKJYbv5iUiPr5FSCUVi4UTZyBssAKWDsjPYDUsBzaZccQuWF8B3nqIm5UX74SmGrM+wvg8baCQ4SMfdf/UiB31PKrxQx4ZLGBDbm5PJg9fudOSVhV404QQLQzwDvct6NS+C694C7siKbzrY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b=qx+n0w4+; arc=none smtp.client-ip=212.227.17.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="qx+n0w4+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1710622734; x=1711227534; i=l.s.r@web.de; bh=ofqs0u73wshEJoImfwxBbHaRLe4/iusqwQ5p8Oy0lpw=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=qx+n0w4+bVGC/w9KSr25C4cqDjQsTFqTGl3LDQ3Iu/t/aEwV5J2TeQu7mFYfjPn9 9PbqnF5k9rNrq8XAZ/N87A84IcFRl0d53Jfnak81IvSkJgohm7sTHQbzfaARcizhb B0qHqh7s36tMLDAXWFBt/sQ7vF7gwyh0oSn9E8SGw6pofFjLy1ANKzFKvxmUli7SG qA1ENbGGNqGxpA7T8v37GgG4yt3m2TLH4E9d8eL+a+X4CUtXQSi65cmvIcX2ew9vr V19D2bdE7lVomyFhOANGjVTjrxdd01I8FTx9DLPX48hhjyIKq56S0F+oP1L769ceP cMuks4LDvu3xMo9aLA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([79.203.19.211]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1M8TBS-1rhDCS1WRE-004oZ0; Sat, 16 Mar 2024 21:45:52 +0100 Message-ID: <197f5ac9-7257-4caa-aa9e-041016c787f7@web.de> Date: Sat, 16 Mar 2024 21:45:51 +0100 Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Git List Cc: Chandra Pratap From: =?utf-8?q?Ren=C3=A9_Scharfe?= Subject: [PATCH 1/2] t-prio-queue: shorten array index message X-Provags-ID: V03:K1:yW/1vgVEyjy6kbArwugLihlVuWQyEJZderk3OTE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L7CZnfCaOXSYcfhv6COI= If we get an unexpected result, the prio-queue unit test reports it like this: # check "result[j++] == show(get)" failed at t/unit-tests/t-prio-queue.c:43 # left: 5 # right: 1 # failed at result[] index 0 That last line repeats "failed" and "result" from the first line. Shorten it to resemble a similar one in t-ctype and also remove the incrementation from the first line to avoid possible distractions from the message of which comparison went wrong where: # check "result[j] == show(get)" failed at t/unit-tests/t-prio-queue.c:43 # left: 5 # right: 1 # j: 0 Signed-off-by: René Scharfe --- t/unit-tests/t-prio-queue.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.44.0 diff --git a/t/unit-tests/t-prio-queue.c b/t/unit-tests/t-prio-queue.c index d78b002f9e..616d0fc86f 100644 --- a/t/unit-tests/t-prio-queue.c +++ b/t/unit-tests/t-prio-queue.c @@ -31,16 +31,18 @@ static void test_prio_queue(int *input, int *result, size_t input_size) get = prio_queue_get(&pq); if (!check(peek == get)) return; - if(!check_int(result[j++], ==, show(get))) - test_msg("failed at result[] index %d", j-1); + if (!check_int(result[j], ==, show(get))) + test_msg(" j: %d", j); + j++; break; case DUMP: while ((peek = prio_queue_peek(&pq))) { get = prio_queue_get(&pq); if (!check(peek == get)) return; - if(!check_int(result[j++], ==, show(get))) - test_msg("failed at result[] index %d", j-1); + if (!check_int(result[j], ==, show(get))) + test_msg(" j: %d", j); + j++; } break; case STACK: