From d2e18635939a940b4c5a23779f1f3fab9a53b780 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 18 Apr 2024 12:27:20 -0700 Subject: [PATCH] Account for every uncovered line in the implementation Closes #23 --- ConflictSet.cpp | 6 +++++- test_conflict_set.py | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 068847b..d604fec 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -2395,7 +2395,11 @@ Iterator firstGeq(Node *n, const std::span key) { } else { n = nextSibling(n); if (n == nullptr) { - return {nullptr, 1}; + // This line is genuinely unreachable from any entry point of the + // final library, since we can't remove a key without introducing a + // key after it, and the only production caller of firstGeq is for + // resuming the setOldestVersion scan. + return {nullptr, 1}; // GCOVR_EXCL_LINE } goto downLeftSpine; } diff --git a/test_conflict_set.py b/test_conflict_set.py index 7c6aaea..09bfe79 100644 --- a/test_conflict_set.py +++ b/test_conflict_set.py @@ -92,6 +92,14 @@ def test_large(): ) +def test_merge_child_node48(): + with DebugConflictSet() as cs: + cs.addWrites(1, write(b"\x00" * 9)) + for i in range(17): + cs.addWrites(1, write(b"\x00" * 10 + bytes([i]))) + cs.addWrites(1, write(b"\x00" * 8, b"\x00" * 10)) + + if __name__ == "__main__": # budget "pytest" for ctest integration without pulling in a dependency. You can of course still use pytest in local development. import argparse