]> git.ipfire.org Git - thirdparty/git.git/commit
t-reftable-tree: split test_tree() into two sub-test functions
authorChandra Pratap <chandrapratap3519@gmail.com>
Sun, 4 Aug 2024 14:06:47 +0000 (19:36 +0530)
committerJunio C Hamano <gitster@pobox.com>
Sun, 4 Aug 2024 16:50:26 +0000 (09:50 -0700)
commitabf1a96773bfaee5e354909d3a6dc172bfbdee96
tree5a443314165bf4bb5eadd8e3fe0e08d0ce846a06
parentec9c0704fc6ad646f5482d3e31e3a5b3be1677ef
t-reftable-tree: split test_tree() into two sub-test functions

In the current testing setup, tests for both tree_search() and
infix_walk() defined by reftable/tree.{c, h} are performed by
a single test function, test_tree(). Split tree_test() into
test_tree_search() and test_infix_walk() responsible for
independently testing tree_search() and infix_walk() respectively.
This improves the overall readability of the test file as well as
simplifies debugging.

Note that the last parameter in the tree_search() functiom is
'int insert' which when set, inserts the key if it is not found
in the tree. Otherwise, the function returns NULL for such cases.

While at it, use 'func' to pass function pointers and not '&func'.

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