diff options
-rw-r--r-- | src/streamblock.nim | 3 | ||||
-rw-r--r-- | tests/tstreamblock.nim | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/streamblock.nim b/src/streamblock.nim index 49c3dcd..403687e 100644 --- a/src/streamblock.nim +++ b/src/streamblock.nim | |||
@@ -34,6 +34,9 @@ type StreamBlock* = object | |||
34 | else: | 34 | else: |
35 | discard | 35 | discard |
36 | 36 | ||
37 | proc isLast*(streamBlock: StreamBlock): bool = | ||
38 | streamBlock.last | ||
39 | |||
37 | proc readSerialised*(bitReader: BitReader): StreamBlock = | 40 | proc readSerialised*(bitReader: BitReader): StreamBlock = |
38 | result.last = bitReader.readBool() | 41 | result.last = bitReader.readBool() |
39 | result.kind = bitReader.readBits(2, uint8).BlockKind | 42 | result.kind = bitReader.readBits(2, uint8).BlockKind |
diff --git a/tests/tstreamblock.nim b/tests/tstreamblock.nim index f1be559..89f69e0 100644 --- a/tests/tstreamblock.nim +++ b/tests/tstreamblock.nim | |||
@@ -25,6 +25,7 @@ suite "streamblock": | |||
25 | rawStream.setPosition(0) | 25 | rawStream.setPosition(0) |
26 | let rawBitReader = rawStream.bitReader() | 26 | let rawBitReader = rawStream.bitReader() |
27 | let streamBlock = readRaw(rawBitReader, uncompressed) | 27 | let streamBlock = readRaw(rawBitReader, uncompressed) |
28 | check streamBlock.isLast() | ||
28 | 29 | ||
29 | let outputStream = newStringStream() | 30 | let outputStream = newStringStream() |
30 | defer: outputStream.close() | 31 | defer: outputStream.close() |
@@ -58,6 +59,7 @@ suite "streamblock": | |||
58 | let outputStream = newStringStream() | 59 | let outputStream = newStringStream() |
59 | defer: outputStream.close() | 60 | defer: outputStream.close() |
60 | let outputBitWriter = outputStream.bitWriter() | 61 | let outputBitWriter = outputStream.bitWriter() |
62 | check streamBlock.isLast() | ||
61 | streamBlock.writeRawTo(outputBitWriter) | 63 | streamBlock.writeRawTo(outputBitWriter) |
62 | outputBitWriter.flush() | 64 | outputBitWriter.flush() |
63 | 65 | ||