Skip to content

Commit

Permalink
Add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
raz-adroll committed Sep 20, 2023
1 parent 9e58cfa commit 5456b66
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/zstd_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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, <<DBin1/binary, DBin2/binary>>).

0 comments on commit 5456b66

Please sign in to comment.