]> Kevux Git Server - rit/commit
t-reftable-pq: add test for index based comparison
authorChandra Pratap <chandrapratap3519@gmail.com>
Thu, 1 Aug 2024 10:59:47 +0000 (16:29 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2024 16:07:29 +0000 (09:07 -0700)
commitc2f831cdfcc41e257380e3b3ca13423ada20fd59
treea32cff6ec5b1dcee1ab652331dabfe923006be4f
parentb37b71b129d9536aca7bb242ef9d0ab43243f613
t-reftable-pq: add test for index based comparison

When comparing two entries, the priority queue as defined by
reftable/pq.{c, h} first compares the entries on the basis of
their ref-record's keys. If the keys turn out to be equal, the
comparison is then made on the basis of their update indices
(which are never equal).

In the current testing setup, only the case for comparison on
the basis of ref-record's keys is exercised. Add a test for
index-based comparison as well. Rename the existing test to
reflect its nature of only testing record-based comparison.

While at it, replace 'strbuf_detach' with 'xstrfmt' to assign
refnames in the existing test. This makes the test conciser.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-reftable-pq.c