-
Notifications
You must be signed in to change notification settings - Fork 634
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
Increase freelist.releaseRange unit test coverage. #36
Conversation
Codecov Report
@@ Coverage Diff @@
## master #36 +/- ##
=========================================
Coverage ? 84.81%
=========================================
Files ? 9
Lines ? 1851
Branches ? 0
=========================================
Hits ? 1570
Misses ? 167
Partials ? 114 Continue to review full report at Codecov.
|
f57bdb2
to
bb8cf8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after fixing speling, thanks!
freelist_test.go
Outdated
}, | ||
} | ||
|
||
// Ensure that releaseRange handles boundry conditions correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/boundry/boundary
bb8cf8d
to
c2355dc
Compare
freelist_test.go
Outdated
@@ -44,6 +44,131 @@ func TestFreelist_release(t *testing.T) { | |||
} | |||
} | |||
|
|||
type testRange struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you define these types out of the func body? do you plan to reuse them in other tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move them into the test function. Thanks!
freelist_test.go
Outdated
}, | ||
releaseRanges: []testRange{ | ||
testRange{100, 198}, | ||
testRange{200, 199}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this range supposed to be out of order? In fact should this range even be here even correctly ordered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a comment. This is intended to simulate the ranges db.freePages
might produce.
freelist_test.go
Outdated
testPage{id: 4, n: 1, allocTxn: 100, freeTxn: 125}, | ||
testPage{id: 5, n: 1, allocTxn: 125, freeTxn: 150}, | ||
testPage{id: 6, n: 1, allocTxn: 150, freeTxn: 175}, | ||
testPage{id: 7, n: 1, allocTxn: 175, freeTxn: 200}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a testPage where the allocTxn is in the first release range and the freeTxn is in the second releaseRange? (Eg 125, 175)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. Added.
c2355dc
to
9245fa7
Compare
lgtm |
Adds a test table covering some of the boundary conditions for
freelist.releaseRange
.cc @heyitsanthony