Fix incorrect calculation of free space

when granting a range that spans a token and inserting a new token, the
free space on the last token that we are handing over has to change.
Add unit test for this too.
This commit is contained in:
Bryan Boreham committed 2015-05-29 09:44:14 +01:00
1 parent c87da5e873
commit 72b30bc699
3 files changed
+19 -1

No files matched your search

+7
View File
@@ -51,3 +51,10 @@ func Subtract(a, b Address) Offset {
common.Assert(a >= b)
return Offset(a - b)
}
func Min(a, b Offset) Offset {
if a > b {
return b
}
return a
}