Skip to content

Commit e6f9cb7

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2953d95 commit e6f9cb7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

t/unit-tests/t-prio-queue.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ static void test_prio_queue(int *input, int *result, size_t input_size)
3131
get = prio_queue_get(&pq);
3232
if (!check(peek == get))
3333
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++;
3637
break;
3738
case DUMP:
3839
while ((peek = prio_queue_peek(&pq))) {
3940
get = prio_queue_get(&pq);
4041
if (!check(peek == get))
4142
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++;
4446
}
4547
break;
4648
case STACK:

0 commit comments

Comments
 (0)