Harmonize the APIs and the coding practices in input_stream and output_stream
This commit is contained in:
parent
fa415774c3
commit
3efad6f7f2
4 changed files with 186 additions and 155 deletions
|
|
@ -5,7 +5,7 @@ import
|
|||
suite "input stream":
|
||||
test "string input":
|
||||
var input = repeat("1234 5678 90AB CDEF\n", 1000)
|
||||
var stream = memoryStream(input)
|
||||
var stream = memoryInput(input)
|
||||
|
||||
check:
|
||||
(stream.readBytes(4) == "1234".toOpenArrayByte(0, 3))
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ proc randomBytes(n: int): seq[byte] =
|
|||
|
||||
suite "output stream":
|
||||
setup:
|
||||
var memStream = OutputStream.init
|
||||
var memStream = memoryOutput()
|
||||
var altOutput: seq[byte] = @[]
|
||||
var tempFilePath = getTempDir() / "faststreams_testfile"
|
||||
var fileStream = OutputStream.init tempFilePath
|
||||
var fileStream = fileOutput(tempFilePath)
|
||||
|
||||
const bufferSize = 1000000
|
||||
var buffer = alloc(bufferSize)
|
||||
var existingBufferStream = OutputStream.init(buffer, bufferSize)
|
||||
var existingBufferStream = memoryOutput(buffer, bufferSize)
|
||||
|
||||
teardown:
|
||||
removeFile tempFilePath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue