Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node removal bug #34

Merged
merged 3 commits into from
Aug 2, 2019
Merged

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Aug 2, 2019

  • Add tests for NodeId::remove()
  • Fix bug of NodeId::remove()
  • Implement some std traits for NodeEdge
    • This is no-breaking change.

I'm currently working to add more assertions, examples, and tests (I'll make Pull Request later), and found that NodeId::remove() has a bug.
Tree becomes inconsistent after removing nodes.
(This can be checked by running tests at the commit 0a7046b.)

I added tests and re-implement NodeId::remove(), and this version seems to work as expected.
(I'm adding many debug assertions to this code on another branch, and all of these assertions did not fail.)

To make tests easy and more complete, I added #[derive(PartialEq, Eq, Hash)] to NodeEdge<T>.
This is non-breaking change.

Deriving more traits from the standard library using the derive attribute is not a breaking change.

--- Future proofing - Rust API Guidelines

It should be used as `NodeEdge<NodeId>`, so these new derives would not
break downstream codes.
Added tests of removal for nodes at various positions.
This new implementation passes all (newly added) removal tests.
Copy link
Owner

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Pretty neat, LGTM thanks!

@saschagrunert saschagrunert merged commit d63972b into saschagrunert:master Aug 2, 2019
@lo48576 lo48576 deleted the fix/node-removal branch August 3, 2019 16:23
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