Repository navigation
[core] Add essential unit tests for TBtree - #23824
ravindra-RKB wants to merge 1 commit into
Conversation
|
You seem to invest effort in writing unit tests. Could you please give some context about the additional coverage this gives on top of the rest of the existing battery? |
|
Hi @dpiparo, Existing tests for TBtree were mostly in legacy macros ( This PR adds isolated unit test coverage under |
|
Hi @ravindra-RKB, thanks for the PR. The test itself is carefully written, but I am closing it, for the reason we already discussed in #23510 (comment): we add tests together with non-trivial changes to the code they cover, not retroactively for code that nobody is changing. A unit test earns its keep by catching a regression when the code under it changes, and this code has not changed in 17 years and has no reason to. TBtree is the clearest case of this in your series of PRs. Nothing in ROOT uses it: outside its own source files, the only references are the legacy programs under I'd also ask you to stop opening further PRs in this series. Where a collection class is widely used and still evolves, like TList, the maintainers have taken the tests, but please leave the decision of where coverage is worth adding to them, and let's not go through the same discussion class by class. If you want to contribute to the core collections, fixing an actual bug or issue, with a test that fails without the fix, is what we are happy to review. Thanks for understanding. |
|
Thanks for the clear explanation @guitargeek, that makes total sense. I will focus on open issues and bug fixes going forward. |
This Pull request:
Introduces essential unit tests for the
TBtreecontainer class incore/cont/test/TBtreeTest.cxx.Changes or fixes:
Adds dedicated Google Test coverage for
TBtree, ROOT's balanced B-tree collection inheriting fromTSeqCollection:DefaultConstructor: Verifies empty state, default order of 3, and non-owning state.CustomOrder: Checks customized tree order and verifies warning diagnostic clamping whenorder < 3.SortedInsertionAndLookup: Tests ordered insertion, index-based access (At,First,Last,operator[]), and key/pointer lookup (FindObject).Rank: Verifies rank calculation of keys within the tree.NodeSplittingAndLargeInsertion: Exercises leaf and inner node splitting, rebalancing under reverse-order insertion of 50 elements, and element removal across nodes.RemoveAndClear: Tests individual element removal and tree clearing.OwnershipAndClearDelete: Verifies object lifecycle management under non-owning and owning (SetOwner(kTRUE)) configurations for bothClear()andDelete().Iteration: Tests forward and backward iteration withTIterandTBtreeIter.ErrorDiagnosticsForNonSortable: Verifies error messages withROOT::TestSupport::CheckDiagsRAIIwhen non-sortable objects are passed toAdd,FindObject,Rank,Remove, or when forbidden operations (Before,After) are called.TBtreeTestincore/cont/test/CMakeLists.txt.Checklist: