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>

René Scharfe committed Mar 16, 2024 at 21:45 UTC e6f9cb76ea14b955fb7b4fcb8dea0786b5b108d3
1 file changed +6 -4
t/unit-tests/t-prio-queue.c
+6 -4
@@ -31,16 +31,18 @@ static void test_prio_queue(int *input, int *result, size_t input_size)
31 get = prio_queue_get(&pq);
32 if (!check(peek == get))
33 return;
34 - if(!check_int(result[j++], ==, show(get)))
35 - test_msg("failed at result[] index %d", j-1);
34 + if (!check_int(result[j], ==, show(get)))
35 + test_msg(" j: %d", j);
36 + j++;
37 break;
38 case DUMP:
39 while ((peek = prio_queue_peek(&pq))) {
40 get = prio_queue_get(&pq);
41 if (!check(peek == get))
42 return;
42 - if(!check_int(result[j++], ==, show(get)))
43 - test_msg("failed at result[] index %d", j-1);
43 + if (!check_int(result[j], ==, show(get)))
44 + test_msg(" j: %d", j);
45 + j++;
46 }
47 break;
48 case STACK: