fix: add zip_compress functions
This commit is contained in:
parent
116c04560d
commit
1886893fa1
|
@ -179,6 +179,11 @@
|
||||||
, unzip/1
|
, unzip/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
%% compressed Funcs
|
||||||
|
-export([ zip_compress/1
|
||||||
|
, zip_uncompress/1
|
||||||
|
]).
|
||||||
|
|
||||||
%% Data encode and decode
|
%% Data encode and decode
|
||||||
-export([ base64_encode/1
|
-export([ base64_encode/1
|
||||||
, base64_decode/1
|
, base64_decode/1
|
||||||
|
@ -817,6 +822,16 @@ zip(S) when is_binary(S) ->
|
||||||
unzip(S) when is_binary(S) ->
|
unzip(S) when is_binary(S) ->
|
||||||
zlib:unzip(S).
|
zlib:unzip(S).
|
||||||
|
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
%% zip_compress Funcs
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
zip_compress(S) when is_binary(S) ->
|
||||||
|
zlib:compress(S).
|
||||||
|
|
||||||
|
zip_uncompress(S) when is_binary(S) ->
|
||||||
|
zlib:uncompress(S).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Data encode and decode Funcs
|
%% Data encode and decode Funcs
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -632,6 +632,17 @@ prop_zip_fun() ->
|
||||||
?FORALL(S, binary(),
|
?FORALL(S, binary(),
|
||||||
S == apply_func(unzip, [apply_func(zip, [S])])).
|
S == apply_func(unzip, [apply_func(zip, [S])])).
|
||||||
|
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
%% Test cases for zip funcs
|
||||||
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
t_zip_compress_funcs(_) ->
|
||||||
|
?PROPTEST(prop_zip_compress_fun).
|
||||||
|
|
||||||
|
prop_zip_compress_fun() ->
|
||||||
|
?FORALL(S, binary(),
|
||||||
|
S == apply_func(zip_uncompress, [apply_func(zip_compress, [S])])).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% Test cases for base64
|
%% Test cases for base64
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue