Re: [PATCH v6 6/7] t-reftable-pq: add test for index based comparison
On Thu, Jul 25, 2024 at 02:55:58PM +0530, Chandra Pratap wrote:
Show 28 quoted lines
> @@ -59,9 +56,49 @@ static void t_pq(void)
> merged_iter_pqueue_release(&pq);
> }
>
> +static void t_pq_index(void)
> +{
> + struct merged_iter_pqueue pq = { 0 };
> + struct reftable_record recs[13];
> + char *last = NULL;
> + size_t N = ARRAY_SIZE(recs), i;
> +
> + for (i = 0; i < N; i++) {
> + reftable_record_init(&recs[i], BLOCK_TYPE_REF);
> + recs[i].u.ref.refname = (char *) "refs/heads/master";
> + }
> +
> + i = 1;
> + do {
> + struct pq_entry e = {
> + .rec = &recs[i],
> + .index = i,
> + };
> +
> + merged_iter_pqueue_add(&pq, &e);
> + merged_iter_pqueue_check(&pq);
> + i = (i * 7) % N;
> + }
> + while (i != 1);Nit: the `while (i != 1)` should go on the same line as the closing
curly brace.
Patrick