From 5456b669836f83109efa84ddd248b5748a6f7d71 Mon Sep 17 00:00:00 2001 From: Ricardo Azpeitia Pimentel Date: Wed, 20 Sep 2023 00:43:58 -0600 Subject: [PATCH] Add testing --- test/zstd_tests.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/zstd_tests.erl b/test/zstd_tests.erl index 4927a04..b3368a5 100644 --- a/test/zstd_tests.erl +++ b/test/zstd_tests.erl @@ -7,3 +7,16 @@ zstd_test() -> ?assertEqual(Data, zstd:decompress( zstd:compress(Data))). + +zstd_stream_test() -> + Bin = << <<"A">> || _ <- lists:seq(1, 1024 * 1024) >>, + CStream = zstd:new_compression_stream(), + ok = zstd:compression_stream_init(CStream), + {ok, CompressionBin} = zstd:stream_compress(CStream, Bin), + {ok, FlushBin} = zstd:stream_flush(CStream), + + DStream = zstd:new_decompression_stream(), + ok = zstd:decompression_stream_init(DStream), + {ok, DBin1} = zstd:stream_decompress(DStream, CompressionBin), + {ok, DBin2} = zstd:stream_decompress(DStream, FlushBin), + ?assertEqual(Bin, <>). \ No newline at end of file