add test for runways
This commit is contained in:
parent
c80701f7d2
commit
cf9074b2f4
|
@ -29,6 +29,9 @@ proc test(args, path: string) =
|
||||||
# " -d:asyncBackend=asyncdispatch " & common_args & " " & path
|
# " -d:asyncBackend=asyncdispatch " & common_args & " " & path
|
||||||
|
|
||||||
task test, "Run all tests":
|
task test, "Run all tests":
|
||||||
|
test "-d:debug --threads:off", "tests/all_tests"
|
||||||
|
test "-d:release --threads:off", "tests/all_tests"
|
||||||
|
test "-d:danger --threads:off", "tests/all_tests"
|
||||||
test "-d:debug --threads:on", "tests/all_tests"
|
test "-d:debug --threads:on", "tests/all_tests"
|
||||||
test "-d:release --threads:on", "tests/all_tests"
|
test "-d:release --threads:on", "tests/all_tests"
|
||||||
test "-d:danger --threads:on", "tests/all_tests"
|
test "-d:danger --threads:on", "tests/all_tests"
|
||||||
|
|
|
@ -400,3 +400,28 @@ suite "randomized tests":
|
||||||
if fileExists(randomBytesFileName):
|
if fileExists(randomBytesFileName):
|
||||||
removeFile randomBytesFileName
|
removeFile randomBytesFileName
|
||||||
|
|
||||||
|
test "ensureRunway":
|
||||||
|
var output = memoryOutput()
|
||||||
|
|
||||||
|
const writes = 256
|
||||||
|
var buffer = newSeq[byte](writes)
|
||||||
|
let totalBytes = block:
|
||||||
|
var tmp = 0
|
||||||
|
for i in 0..<writes:
|
||||||
|
tmp += i
|
||||||
|
buffer[i] = byte(i)
|
||||||
|
tmp
|
||||||
|
|
||||||
|
output.ensureRunway(totalBytes)
|
||||||
|
|
||||||
|
for i in 0..<writes:
|
||||||
|
output.write(buffer.toOpenArray(0, i - 1))
|
||||||
|
|
||||||
|
output.flush()
|
||||||
|
|
||||||
|
let res = output.getOutput()
|
||||||
|
var j = 0
|
||||||
|
for i in 0..<writes:
|
||||||
|
check:
|
||||||
|
res[j..<j+i] == buffer[0..<i]
|
||||||
|
j += i
|
||||||
|
|
Loading…
Reference in New Issue