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-28 18:12:30 +01:00
1 parent 32c35da402
commit af5531cbf6
3 files changed
+19 -1

No files matched your search

+7
View File
@@ -52,3 +52,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
}