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

limitedmap fixes and tests #6561

Merged
merged 3 commits into from Aug 19, 2015
Merged

limitedmap fixes and tests #6561

merged 3 commits into from Aug 19, 2015

Conversation

@casey
Copy link
Contributor

casey commented Aug 17, 2015

This PR consists of three commits.

The first fixes a bug where the size of a limited map was actually one less than the maximum size set. This shouldn't matter at all for the existing code, since there is only one limitedmap, and its size is very large.

The second disallows unlimited limited maps, since that doesn't make very much sense, and simplifies the code a little bit. (I'm not too attached to this, in case anyone doesn't like this change I can just remove it.)

The third adds unit tests for limitedmap, which were previously absent.

I elected to leave the commits unsquashed for review, since they're logically separate, but I can squash if desired.

@casey casey changed the title Limitedmap fixes limitedmap fixes and tests Aug 17, 2015
@sipa
Copy link
Member

sipa commented Aug 17, 2015

ACK

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented Aug 17, 2015

utACK

@laanwj
Copy link
Member

laanwj commented Aug 19, 2015

utACK. Thanks a lot for adding tests!

@laanwj laanwj merged commit 7bd57bb into bitcoin:master Aug 19, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Aug 19, 2015
7bd57bb Add limitedmap test (Casey Rodarmor)
8b06894 Disallow unlimited limited maps (Casey Rodarmor)
fd2d862 Make limited map actually respect max size (Casey Rodarmor)
@casey casey deleted the casey:limitedmap branch Aug 19, 2015
@dcousens
Copy link
Contributor

dcousens commented Aug 20, 2015

Is it worth adding a test to verify that insert after max_size is reached, it doesn't increment size?
(Happy to do this)

@casey
Copy link
Contributor Author

casey commented Aug 20, 2015

It does this already, unless you were thinking of a more substantial test: 11 elements are added (one one off, and then ten in a loop) and then line 39 checks that there are only 10 elements.

@dcousens
Copy link
Contributor

dcousens commented Aug 20, 2015

Sorry, I missed that first insert @casey. utACK :)

luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Jan 9, 2016
luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Jan 9, 2016
Github-Pull: bitcoin#6561
Rebased-From: 7bd57bb
luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.