-
Notifications
You must be signed in to change notification settings - Fork 2
KF-27 Add tests for TreeMap #54
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive test coverage for the TreeMap class and removes a potentially unsafe removeByObject method that could delete incorrect objects due to faulty node construction logic.
- Adds extensive BDD-style test cases covering all TreeMap methods and edge cases
- Removes the problematic
removeByObjectmethod to prevent incorrect object deletion - Suppresses a deprecated API warning in the GenericTableAvl allocation routine
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/TreeMapTest.cpp | New comprehensive test file covering TreeMap functionality with BDD-style scenarios |
| test/CMakeLists.txt | Adds TreeMapTest.cpp to the build configuration |
| include/kf/TreeMap.h | Removes the unsafe removeByObject method |
| include/kf/GenericTableAvl.h | Suppresses deprecation warning for ExAllocatePoolWithTag |
@SergiusTheBest I've encountered the same problem in tests for LinkedTreeMap: the |
@belyshevdenis But we use that method, so we need it. |
Oh, I see! |
I've removed removeByObject method because it can delete wrong object using the view of a node that doesn't exists. For example, if you try to remove object with non-existing value 60, it constructs the node with key 2 (that equals to value 20) and deletes it.