diff options
-rw-r--r-- | tests/gziplike/tgziplike.nim | 13 |
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 @@ | |||
17 | import unittest, os, ospaths, osproc, times | 17 | import unittest, os, ospaths, osproc, times |
18 | import gziplike | 18 | import gziplike |
19 | 19 | ||
20 | proc log(messages: varargs[string, `$`]) = | ||
21 | stdout.write(" ") | ||
22 | for msg in messages: stdout.write(msg) | ||
23 | stdout.write("\n") | ||
24 | stdout.flushFile() | ||
25 | |||
20 | suite "main": | 26 | suite "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) |