Fix interpolation search#2
Merged
RAttab merged 1 commit intoRAttab:masterfrom Oct 12, 2017
pjhades:fix/interpolation-search
Merged
Fix interpolation search#2RAttab merged 1 commit intoRAttab:masterfrom pjhades:fix/interpolation-search
RAttab merged 1 commit intoRAttab:masterfrom
pjhades:fix/interpolation-search
Conversation
RAttab
reviewed
Oct 11, 2017
| struct index *index; | ||
|
|
||
| rill_key_t data1[CAP] = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27}; | ||
| index = make_index(data1, CAP); |
Owner
There was a problem hiding this comment.
You can avoid having to create a temporary array and variable by wrapping the make_index call ina macro like so: https://github.com/RAttab/rill/blob/master/test/coder_test.c#L61
I don't recommend doing that for regular code, but for tests, it significantly reduces the boiler plate.
Owner
|
Looks good, just need that extra macro to reduce boilerplate in the tests and we can merge this. Thanks for the fix :) |
Fix the comparison after the initial interpolation jump so that we no longer miss the target key. Add unit tests for indexer functions.
Contributor
Author
|
Updated, but there's still duplication as the content of the array is specified twice, anyway the test interface is simpler than before I think. |
Owner
|
All good, thanks :) |
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.
Fix the comparison after the initial interpolation jump so that we no longer miss the target key.
Add unit tests for indexer functions.