Faster RB tree violation checks - #69
Open
odorovskoy wants to merge 1 commit into
Open
Conversation
Owner
|
Probably overkill for a test tool, but thank you for the contribution. I will review this soon when I have time again. |
5cript
requested changes
Aug 30, 2026
5cript
left a comment
Owner
There was a problem hiding this comment.
@odorovskoy This is an enormous improvement.
Can you do the 2 mini improvements? I'll then approve and merge.
| auto nodeColor = i.color(); | ||
| if (nodeColor == rb_color::red) | ||
| // check that all nodes have red or black coloring. (seems obvious, but is not on bug) | ||
| EXPECT_EQ(true, node.color() == rb_color::black || node.color() == rb_color::red); |
Owner
There was a problem hiding this comment.
I prefer EXPECT_TRUE, i know the old impl also used EXPECT_EQ.
| @@ -19,82 +18,34 @@ void testRedBlackPropertyViolation(TreeT const& tree) | |||
| // root is always black. | |||
| EXPECT_EQ(tree.root().color(), rb_color::black); | |||
Owner
There was a problem hiding this comment.
You didnt introduce this, but this is unchecked root access that could blow up on an empty tree.
Can you fix this to for me?
It could be relevant now when this function is used more frequently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
testRedBlackPropertyViolation()optimizations described in #68