aboutsummaryrefslogtreecommitdiff
path: root/tests/tgziplike.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tgziplike.nim')
-rw-r--r--tests/tgziplike.nim40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/tgziplike.nim b/tests/tgziplike.nim
new file mode 100644
index 0000000..2b79240
--- /dev/null
+++ b/tests/tgziplike.nim
@@ -0,0 +1,40 @@
1# gzip-like LZSS compressor
2# Copyright (C) 2018 Pacien TRAN-GIRARD
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as
6# published by the Free Software Foundation, either version 3 of the
7# License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17import unittest, os, ospaths, osproc
18import gziplike
19
20const tempDir = "tmp"
21
22suite "main":
23 setup: createDir(tempDir)
24 teardown: removeDir(tempDir)
25
26 test "identity (text)":
27 let input = "license.md"
28 let intermediate = tempDir / "compressed"
29 let final = tempDir / "decompressed"
30 compress.transform(input, intermediate)
31 decompress.transform(intermediate, final)
32 check startProcess("cmp", args=[input, final], options={poUsePath}).waitForExit() == 0
33
34 test "identity (binary)":
35 let input = "tests" / "tgziplike"
36 let intermediate = tempDir / "compressed"
37 let final = tempDir / "decompressed"
38 compress.transform(input, intermediate)
39 decompress.transform(intermediate, final)
40 check startProcess("cmp", args=[input, final], options={poUsePath}).waitForExit() == 0