Mocking with multiple or no arguments#381
Draft
MaartenS11 wants to merge 10 commits into
Draft
Conversation
4edfc07 to
fed0f75
Compare
This allows variable numbers of arguments to be stored and matched. TODO: - Use buckets for collisions! - Update the overrides state in snapshots
fed0f75 to
5076a38
Compare
6061893 to
76c8650
Compare
Previously remove would look up the item again when we already look it up and should know where it is.
76c8650 to
160d2e0
Compare
e198853 to
de0a71e
Compare
de0a71e to
a4b840d
Compare
…tead of implementing it partially myself which made it more complex Unordered map already has buckets, by then storing my own bucket list in those buckets things just got more complex and slower.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MIO was restricted to mocking primitives that had one argument, this PR aims to expand mocking to work with any number of arguments. This is achieved by hashing (with FNV-1a) the
argument list+fidxand using this as the key in the mocking table. Since hashes can of course collide (especially when using a fast non-cryptographic hash like we do here) the table does not store a single element for each hash but a list of buckets (which should normally be extremely short).