This commit is contained in:
2020-01-25 11:18:56 +01:00
commit 57f3c22b32
4 changed files with 278 additions and 0 deletions

26
tests/zlib.carp Normal file
View File

@@ -0,0 +1,26 @@
(load "Test.carp")
(load "zlib.carp")
(use-all ZLib Test)
(deftest test
(assert-true test
(Result.success? &(deflate @"hi"))
"deflation returns success"
)
(assert-true test
(Result.success? &(inflate (Result.unsafe-from-success (deflate @"hi"))))
"deflation->inflation returns success"
)
(assert-equal test
&(Result.Error @"Data Error")
&(inflate (ZBytes.init 3 @"hi"))
"inflating random data returns data error"
)
(assert-equal test
&(Result.Success @"hi")
&(inflate (Result.unsafe-from-success (deflate @"hi")))
"deflation->inflation works"
)
)