summaryrefslogtreecommitdiff
path: root/tests/modules/compress/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-10 23:05:05 +0800
committerruki <[email protected]>2022-05-10 23:05:05 +0800
commit630899925ff386150f022b82374c4d268bcc0443 (patch)
tree4409c18e6ea90ca1a9a26a35e42921608f652b94 /tests/modules/compress/test.lua
parent04c3472a9e966fee7210dcdaf892d6f50c200ce1 (diff)
add tests
Diffstat (limited to 'tests/modules/compress/test.lua')
-rw-r--r--tests/modules/compress/test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modules/compress/test.lua b/tests/modules/compress/test.lua
index b12e2e877..50a17d323 100644
--- a/tests/modules/compress/test.lua
+++ b/tests/modules/compress/test.lua
@@ -3,5 +3,12 @@ import("core.compress.lz4")
function test_lz4(t)
t:are_equal(lz4.decompress(lz4.compress("hello world")):str(), "hello world")
t:are_equal(lz4.block_decompress(lz4.block_compress("hello world"), 11):str(), "hello world")
+ local srcfile = os.tmpfile() .. ".src"
+ local dstfile = os.tmpfile() .. ".dst"
+ local dstfile2 = os.tmpfile() .. ".dst2"
+ io.writefile(srcfile, "hello world")
+ lz4.compress_file(srcfile, dstfile)
+ lz4.decompress_file(dstfile, dstfile2)
+ t:are_equal(io.readfile(srcfile) == io.readfile(dstfile2))
end