aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorpacien2018-12-03 18:49:04 +0100
committerpacien2018-12-03 18:54:17 +0100
commitd1c7371f4918431df970fbee112eca4f073716cd (patch)
tree353dcf08aa0e516da8b50ef5c7a29d5ef5479f01 /tests
parent925f8d7176c3d54d435896ec0d2eabda634bbcc8 (diff)
downloadgziplike-d1c7371f4918431df970fbee112eca4f073716cd.tar.gz
format test output
Diffstat (limited to 'tests')
-rw-r--r--tests/gziplike/tgziplike.nim13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/gziplike/tgziplike.nim b/tests/gziplike/tgziplike.nim
index b26a453..fa87248 100644
--- a/tests/gziplike/tgziplike.nim
+++ b/tests/gziplike/tgziplike.nim
@@ -17,17 +17,24 @@
17import unittest, os, ospaths, osproc, times 17import unittest, os, ospaths, osproc, times
18import gziplike 18import gziplike
19 19
20proc log(messages: varargs[string, `$`]) =
21 stdout.write(" ")
22 for msg in messages: stdout.write(msg)
23 stdout.write("\n")
24 stdout.flushFile()
25
20suite "main": 26suite "main":
21 const tempDir = "tmp" 27 const tempDir = "tmp"
22 28
23 proc testIdentity(input: string, intermediate = tempDir / "compressed", final = tempDir / "decompressed"): bool = 29 proc testIdentity(input: string, intermediate = tempDir / "compressed", final = tempDir / "decompressed"): bool =
30 log("working on file: ", input)
24 let compressionStartTime = getTime() 31 let compressionStartTime = getTime()
25 compress.transform(input, intermediate) 32 compress.transform(input, intermediate)
26 echo("compression done in ", getTime() - compressionStartTime) 33 log("compression done in ", getTime() - compressionStartTime)
27 echo("compression ratio: ", (intermediate.getFileSize() * 100) div input.getFileSize(), "%") 34 log("compression ratio: ", (intermediate.getFileSize() * 100) div input.getFileSize(), "%")
28 let decompressionStartTime = getTime() 35 let decompressionStartTime = getTime()
29 decompress.transform(intermediate, final) 36 decompress.transform(intermediate, final)
30 echo("decompression done in ", getTime() - decompressionStartTime) 37 log("decompression done in ", getTime() - decompressionStartTime)
31 startProcess("cmp", args=[input, final], options={poUsePath}).waitForExit() == 0 38 startProcess("cmp", args=[input, final], options={poUsePath}).waitForExit() == 0
32 39
33 setup: createDir(tempDir) 40 setup: createDir(tempDir)