1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 17:26:12 +02:00

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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2024-03-16 21:45:51 +01:00 committed by Junio C Hamano
parent 2953d95d40
commit e6f9cb76ea

View File

@ -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: