Add tests for delayed var-size writes

This commit is contained in:
Zahary Karadjov 2020-05-25 11:33:56 +03:00
commit 5d7cad792f
No known key found for this signature in database
GPG key ID: C8936F8A3073D609
3 changed files with 169 additions and 82 deletions

View file

@ -151,9 +151,13 @@ proc setFauxEof*(buffers: PageBuffers, pos: Natural): Natural =
proc restoreEof*(buffers: PageBuffers, pos: Natural) =
buffers.fauxEofPos = pos
template allocWritablePage*(pageSize: Natural, writtenToParam: Natural = 0): auto =
PageRef(data: allocRef newString(pageSize),
writtenTo: writtenToParam)
func addWritablePage*(buffers: PageBuffers, pageSize: Natural): PageRef =
trackWrittenToEnd(buffers)
result = PageRef(data: allocRef newString(pageSize))
result = allocWritablePage(pageSize)
buffers.queue.addLast result
func getWritablePage*(buffers: PageBuffers,