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

Bugfix multimap size #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NavyaZaveri
Copy link

@NavyaZaveri NavyaZaveri commented May 22, 2020

With the current implementation, this test fails:

  #[test]
    fn test_size() {
        let mut mmap = MultiMap::<i32, String>::new();
        mmap.insert(1, "abc".into());
        mmap.insert(1, "abc".into());
        mmap.delete(1, "abc".into());
        assert_eq!( mmap.size(),0)
    }

The reason for this is that counter was being incremented for every insert, even if the key-value pair was a duplicate.

Note: this PR is built on top of the previous PR #5

@NavyaZaveri NavyaZaveri force-pushed the bugfix_multimap_size branch from cd1006a to 5fe9a9f Compare May 22, 2020 00:41
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.

1 participant