From: René Scharfe Date: Sat, 16 Mar 2024 20:45:51 +0000 (+0100) Subject: t-prio-queue: shorten array index message X-Git-Tag: v2.45.0-rc0~71^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6f9cb76ea14b955fb7b4fcb8dea0786b5b108d3;p=thirdparty%2Fgit.git t-prio-queue: shorten array index message 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 Signed-off-by: Junio C Hamano --- 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: