]> Kevux Git Server - rit/commit
t-reftable-tree: improve the test for infix_walk()
authorChandra Pratap <chandrapratap3519@gmail.com>
Sun, 4 Aug 2024 14:06:49 +0000 (19:36 +0530)
committerJunio C Hamano <gitster@pobox.com>
Sun, 4 Aug 2024 16:50:27 +0000 (09:50 -0700)
commit3a498b49d1b7d1ffc939b87310533a40ecbd8c43
tree97b7f4cdad3de1dbb9b48c4e7e058fb559a5ec93
parentc70022c1b9b3a6ea4d4d3f4b54edf0d759e520e3
t-reftable-tree: improve the test for infix_walk()

In the current testing setup for infix_walk(), the following
properties of an infix traversal of a tree remain untested:
- every node of the tree must be visited
- every node must be visited exactly once
In fact, only the property 'traversal in increasing order' is tested.
Modify test_infix_walk() to check for all the properties above.

This can be achieved by storing the nodes' keys linearly, in a nullified
buffer, as we visit them and then checking the input keys against this
buffer in increasing order. By checking that the element just after
the last input key is 'NULL' in the output buffer, we ensure that
every node is traversed exactly once.

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-tree.c