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

test(core): add unit tests for merge trait #1738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pluveto
Copy link

@pluveto pluveto commented Nov 21, 2024

Description

This update adds unit tests for the Merge trait implementations on BTreeMap, BTreeSet, Vec, and tuples. It also includes tests for the is_empty and take methods to ensure their correct functionality.

Notes to the Reviewers

  • The tests cover basic scenarios for merging collections and checking their emptiness.
  • Consider the potential method name conflict with BTreeSet's existing take method.

Changelog Notice

  • Added unit tests for merging functionality and utility methods (is_empty, take) on various collection types.

Checklists

All Submissions:

  • I've signed all my commits.
  • I followed the contribution guidelines.
  • I ran cargo fmt and cargo clippy before committing.

Copy link
Contributor

@LagginTimes LagginTimes left a comment

Choose a reason for hiding this comment

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

Would it be valuable to include tests for conflict scenarios as well? For example:

let mut map1: BTreeMap<i32, &str> = BTreeMap::new();
map1.insert(1, "a");
let mut map2: BTreeMap<i32, &str> = BTreeMap::new();
map2.insert(1, "b");

map1.merge(map2);

assert_eq!(map1.len(), 1);
assert_eq!(map1.get(&1), Some(&"b"));

crates/core/tests/test_merge.rs Outdated Show resolved Hide resolved
@pluveto
Copy link
Author

pluveto commented Nov 25, 2024

I've added refactored empty check assertions and merge conflict tests. Squashed.

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

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

ACK 871df7bb24b6c15a096d6b98bdfc7d6877cbd29c

crates/core/tests/test_merge.rs Outdated Show resolved Hide resolved
…ncluding conflict scenarios and checking for empty structures
@LagginTimes
Copy link
Contributor

ACK 665273d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants