Skip to content

t: port reftable/tree_test.c to the unit testing framework

Chandra Pratap git 11 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest posting 2/25 patches 4 repliesIn review
  2. v6 posting 2/25 patches 1 replySuperseded
  3. v7 posting 1/27 patches 2 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v6 posting 1/27 patches3 repliesSuperseded
v5 posting 2/27 patches9 repliesSuperseded
v5 posting 1/25 patches5 repliesSuperseded
v4 posting 2/25 patches11 repliesSuperseded
v4 posting 1/27 patches1 replySuperseded
v37 patches1 replySuperseded
v27 patches4 repliesSuperseded
v15 patches5 repliesSuperseded

Changes in v7 from the cover letter

- Fix style issues in a comment introduced in patch 3 of the previous series

Patches in v7 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5reftable: remove unnecessary curly braces in reftable/tree.creftable/tree.c+5 -100 replies
2/5t: move reftable/tree_test.c to the unit testing frameworkMakefile reftable/reftable-tests.h reftable/tree_test.c +2 more+61 -630 replies
3/5t-reftable-tree: split test_tree() into two sub-test functionst/unit-tests/t-reftable-tree.c+19 -40 replies
4/5t-reftable-tree: add test for non-existent keyt/unit-tests/t-reftable-tree.c+1 -00 replies
5/5t-reftable-tree: improve the test for infix_walk()t/unit-tests/t-reftable-tree.c+15 -70 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchPatrick SteinhardtChristian Couder
SeriesMentored-by Mentored-by
1/5Mentored-by Mentored-by
2/5Mentored-by Mentored-by
3/5Mentored-by Mentored-by
4/5Mentored-by Mentored-by
5/5Mentored-by Mentored-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [GSoC][PATCH v7 0/5] t: port reftable/tree_test.c to the unit testing framework

The reftable library comes with self tests, which are exercised as part of the usual end-to-end tests and are designed to observe the end-user visible effects of Git commands. What it exercises, however, is a better match for the unit-testing framework, merged at 8bf6fbd0 (Merge branch 'js/doc-unit-tests', 2023-12-09), which is designed to observe how low level implementation details, at the level of sequences of individual function calls, behave.

Hence, port reftable/tree_test.c to the unit testing framework and improve upon the ported test. The first patch in the series is preparatory cleanup, the second patch moves the test to the unit testing framework, and the rest of the patches improve upon the ported test.

---
Changes in v7:
- Fix style issues in a comment introduced in patch 3 of the previous series

CI/PR: https://github.com/gitgitgadget/git/pull/1740

Chandra Pratap(5):
reftable: remove unnecessary curly braces in reftable/tree.c
t: move reftable/tree_test.c to the unit testing framework
t-reftable-tree: split test_tree() into two sub-test
t-reftable-tree: add test for non-existent key
t-reftable-tree: improve the test for infix_walk()

Makefile                       |  2 +-
reftable/reftable-tests.h      |  1 -
reftable/tree.c                | 15 +++-------
reftable/tree_test.c           | 60 ----------------------
t/helper/test-reftable.c       |  1 -
t/unit-tests/t-reftable-tree.c | 83 +++++++++++++++++++++++++++++++++++++
6 files changed, 89 insertions(+), 73 deletions(-)

Range-diff against v6:

1:  d4a45e602c = 1:  d738bf57e2 reftable: remove unnecessary curly braces in reftable/tree.c
2:  9148e740e8 ! 2:  f090ace685 t: move reftable/tree_test.c to the unit testing framework
    @@ t/unit-tests/t-reftable-tree.c (new)
     +	size_t i = 1;
     +	struct curry c = { 0 };
     +
    -+	/* pseudo-randomly insert the pointers for elements between
    -+	 * values[1] and values[10] (included) in the tree.
    ++	/*
    ++	 * Pseudo-randomly insert the pointers for elements between
    ++	 * values[1] and values[10] (inclusive) in the tree.
     +	 */
     +	do {
     +		nodes[i] = tree_search(&values[i], &root, &t_compare, 1);

3: f73ad11238 ! 3: 22256e77b3 t-reftable-tree: split test_tree() into two sub-test functions
@@ t/unit-tests/t-reftable-tree.c: static void check_increasing(void *arg, void *ke
size_t i = 1;
- struct curry c = { 0 };

-- /* pseudo-randomly insert the pointers for elements between
-- * values[1] and values[10] (included) in the tree.
-+ /* Pseudo-randomly insert the pointers for elements between
-+ * values[1] and values[10] (inclusive) in the tree.
- */
- do {
- nodes[i] = tree_search(&values[i], &root, &t_compare, 1);
+ /*
+ * Pseudo-randomly insert the pointers for elements between
@@ t/unit-tests/t-reftable-tree.c: static void t_tree(void)
check_pointer_eq(nodes[i], tree_search(&values[i], &root, &t_compare, 0));
}

4:  edb02d2e84 = 4:  0d04daad28 t-reftable-tree: add test for non-existent key
5:  6aecd4e374 = 5:  80d4aa2a66 t-reftable-tree: improve the test for infix_walk()