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