diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tmain.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tmain.nim b/tests/tmain.nim new file mode 100644 index 0000000..2deb443 --- /dev/null +++ b/tests/tmain.nim | |||
@@ -0,0 +1,32 @@ | |||
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 | |||
17 | import unittest, os, ospaths, osproc | ||
18 | import main | ||
19 | |||
20 | const tempDir = "tmp" | ||
21 | |||
22 | suite "main": | ||
23 | setup: createDir(tempDir) | ||
24 | teardown: removeDir(tempDir) | ||
25 | |||
26 | test "identity": | ||
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 | ||