Skip to content

[core] Add essential unit tests for TOrdCollection - #23763

Open
ravindra-RKB wants to merge 3 commits into
root-project:masterfrom
ravindra-RKB:feature-tordcollection-tests
Open

ravindra-RKB wants to merge 3 commits into
root-project:masterfrom
ravindra-RKB:feature-tordcollection-tests

Conversation

@ravindra-RKB

Copy link
Copy Markdown
Contributor

Description

This PR introduces comprehensive unit tests for TOrdCollection in core/cont/test/TOrdCollectionTest.cxx.

TOrdCollection is an ordered sequence container backed by an array with gap-buffer semantics, actively used across ROOT subsystems. Previously, there was no dedicated Google Test coverage for it in core/cont/test.

The new test suite covers:

  • Default and custom capacity construction and empty collection boundary behavior.
  • Sequential and positional insertions (AddFirst, AddLast, AddAt, AddBefore, AddAfter).
  • In-place element replacement (PutAt).
  • Removal operations (Remove, RemoveAt) across boundaries (head, middle, tail).
  • Relative element navigation (First, Last, Before, After, IndexOf).
  • Sorting and binary search (Sort, BinarySearch).
  • Ownership semantics, object lifetime, and cleanup (SetOwner, Clear, Delete).
  • Forward and reverse iteration (TIter and TOrdCollectionIter).

Checklist

  • Code follows the project's style conventions and formatting guidelines.
  • New unit tests have been added and verified locally.
  • Tested against MSVC with /W4 /WX with zero warnings.

@github-actions

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 11h 26m 54s ⏱️
 3 867 tests  3 864 ✅ 0 💤  3 ❌
73 598 runs  73 552 ✅ 0 💤 46 ❌

For more details on these failures, see this check.

Results for commit 5c066eb.

Comment thread core/cont/test/TOrdCollectionTest.cxx Outdated
EXPECT_TRUE(col.IsEmpty());
EXPECT_EQ(nullptr, col.First());
EXPECT_EQ(nullptr, col.Last());
EXPECT_EQ(nullptr, col.At(0));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing error cases that will issue an error message, please use ROOT::TestSupport::CheckDiagsRAII.

@ravindra-RKB

Copy link
Copy Markdown
Contributor Author

Updated! I have removed the unhandled illegal-index calls from DefaultConstructor and added a dedicated OutOfBoundsAndIllegalIndices test using ROOT::TestSupport::CheckDiagsRAII to verify error diagnostics for illegal indices (At, PutAt) as well as unsorted BinarySearch.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants