aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test/zlib_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-02 06:50:54 +0100
committerBjörn Gustavsson <[email protected]>2016-03-10 15:11:00 +0100
commit0ba20cd6d43e277593b59463d2c2959bb6db0957 (patch)
tree5c9fac877f54fe9b26622125707f030361af86c1 /lib/kernel/test/zlib_SUITE.erl
parent3dfdf35c65b8985a3abe21ef83f27cc8e82ba11c (diff)
downloadotp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.gz
otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.bz2
otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.zip
Remove ?line macros
While we are it, also re-ident the files.
Diffstat (limited to 'lib/kernel/test/zlib_SUITE.erl')
-rw-r--r--lib/kernel/test/zlib_SUITE.erl382
1 files changed, 191 insertions, 191 deletions
diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl
index 1b8105d51a..97e1e2caa5 100644
--- a/lib/kernel/test/zlib_SUITE.erl
+++ b/lib/kernel/test/zlib_SUITE.erl
@@ -109,16 +109,16 @@ end_per_group(_GroupName, Config) ->
%% Test open/0 and close/1.
api_open_close(Config) when is_list(Config) ->
- ?line Fd1 = zlib:open(),
- ?line Fd2 = zlib:open(),
+ Fd1 = zlib:open(),
+ Fd2 = zlib:open(),
?m(false,Fd1 == Fd2),
?m(ok,zlib:close(Fd1)),
?m(?BARG, zlib:close(Fd1)),
?m(ok,zlib:close(Fd2)),
-
+
%% Make sure that we don't get any EXIT messages if trap_exit is enabled.
- ?line process_flag(trap_exit, true),
- ?line Fd3 = zlib:open(),
+ process_flag(trap_exit, true),
+ Fd3 = zlib:open(),
?m(ok,zlib:close(Fd3)),
receive
Any -> ct:fail({unexpected_message,Any})
@@ -127,58 +127,58 @@ api_open_close(Config) when is_list(Config) ->
%% Test deflateInit/2 and /6.
api_deflateInit(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(?BARG, zlib:deflateInit(gurka, none)),
?m(?BARG, zlib:deflateInit(gurka, gurka)),
?m(?BARG, zlib:deflateInit(Z1, gurka)),
Levels = [none, default, best_speed, best_compression] ++ lists:seq(0,9),
lists:foreach(fun(Level) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
?m(ok, zlib:deflateInit(Z, Level)),
?m(ok,zlib:close(Z))
end, Levels),
%% /6
?m(?BARG, zlib:deflateInit(Z1,gurka,deflated,-15,8,default)),
-
+
?m(?BARG, zlib:deflateInit(Z1,default,undefined,-15,8,default)),
-
+
?m(?BARG, zlib:deflateInit(Z1,default,deflated,48,8,default)),
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-20,8,default)),
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-7,8,default)),
?m(?BARG, zlib:deflateInit(Z1,default,deflated,7,8,default)),
-
+
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,0,default)),
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,10,default)),
-
+
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,8,0)),
?m(?BARG, zlib:deflateInit(Z1,default,deflated,-15,8,undefined)),
-
+
lists:foreach(fun(Level) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
?m(ok, zlib:deflateInit(Z, Level, deflated, -15, 8, default)),
?m(ok,zlib:close(Z))
end, Levels),
-
+
lists:foreach(fun(Wbits) ->
- ?line Z11 = zlib:open(),
+ Z11 = zlib:open(),
?m(ok, zlib:deflateInit(Z11,best_compression,deflated,
Wbits,8,default)),
- ?line Z12 = zlib:open(),
+ Z12 = zlib:open(),
?m(ok, zlib:deflateInit(Z12,default,deflated,-Wbits,8,default)),
?m(ok,zlib:close(Z11)),
?m(ok,zlib:close(Z12))
end, lists:seq(8, 15)),
-
+
lists:foreach(fun(MemLevel) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
?m(ok, zlib:deflateInit(Z,default,deflated,-15,
MemLevel,default)),
?m(ok,zlib:close(Z))
end, lists:seq(1,8)),
-
+
Strategies = [filtered,huffman_only,rle,default],
lists:foreach(fun(Strategy) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
?m(ok, zlib:deflateInit(Z,best_speed,deflated,-15,8,Strategy)),
?m(ok,zlib:close(Z))
end, Strategies),
@@ -188,7 +188,7 @@ api_deflateInit(Config) when is_list(Config) ->
%% Test deflateSetDictionary.
api_deflateSetDictionary(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1, default)),
?m(Id when is_integer(Id), zlib:deflateSetDictionary(Z1, <<1,1,2,3,4,5,1>>)),
?m(Id when is_integer(Id), zlib:deflateSetDictionary(Z1, [1,1,2,3,4,5,1])),
@@ -200,7 +200,7 @@ api_deflateSetDictionary(Config) when is_list(Config) ->
%% Test deflateReset.
api_deflateReset(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1, default)),
?m(_, zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, none)),
?m(ok, zlib:deflateReset(Z1)),
@@ -210,7 +210,7 @@ api_deflateReset(Config) when is_list(Config) ->
%% Test deflateParams.
api_deflateParams(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1, default)),
?m(_, zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, none)),
?m(ok, zlib:deflateParams(Z1, best_compression, huffman_only)),
@@ -219,7 +219,7 @@ api_deflateParams(Config) when is_list(Config) ->
%% Test deflate.
api_deflate(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1, default)),
?m([B] when is_binary(B), zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, finish)),
?m(ok, zlib:deflateReset(Z1)),
@@ -230,18 +230,18 @@ api_deflate(Config) when is_list(Config) ->
?m(B when is_list(B), zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, sync)),
?m(B when is_list(B), zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, full)),
?m(B when is_list(B), zlib:deflate(Z1, <<>>, finish)),
-
+
?m(?BARG, zlib:deflate(gurka, <<1,1,1,1,1,1,1,1,1>>, full)),
?m(?BARG, zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, asdj)),
?m(?BARG, zlib:deflate(Z1, <<1,1,1,1,1,1,1,1,1>>, 198)),
%% Causes problems ERROR REPORT
?m(?BARG, zlib:deflate(Z1, [asdj,asd], none)),
-
+
?m(ok, zlib:close(Z1)).
%% Test deflateEnd.
api_deflateEnd(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1, default)),
?m(ok, zlib:deflateEnd(Z1)),
?m({'EXIT', {einval,_}}, zlib:deflateEnd(Z1)), %% ??
@@ -253,19 +253,19 @@ api_deflateEnd(Config) when is_list(Config) ->
?m(B when is_list(B), zlib:deflate(Z1, <<"Kilroy was here">>)),
?m(B when is_list(B), zlib:deflate(Z1, <<"Kilroy was here">>, finish)),
?m(ok, zlib:deflateEnd(Z1)),
-
+
?m(ok, zlib:close(Z1)).
%% Test inflateInit /1 and /2.
api_inflateInit(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(?BARG, zlib:inflateInit(gurka)),
?m(ok, zlib:inflateInit(Z1)),
?m({'EXIT',{einval,_}}, zlib:inflateInit(Z1, 15)), %% ??
lists:foreach(fun(Wbits) ->
- ?line Z11 = zlib:open(),
+ Z11 = zlib:open(),
?m(ok, zlib:inflateInit(Z11,Wbits)),
- ?line Z12 = zlib:open(),
+ Z12 = zlib:open(),
?m(ok, zlib:inflateInit(Z12,-Wbits)),
?m(ok,zlib:close(Z11)),
?m(ok,zlib:close(Z12))
@@ -279,7 +279,7 @@ api_inflateInit(Config) when is_list(Config) ->
%% Test inflateSetDictionary.
api_inflateSetDictionary(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:inflateInit(Z1)),
?m(?BARG, zlib:inflateSetDictionary(gurka,<<1,1,1,1,1>>)),
?m(?BARG, zlib:inflateSetDictionary(Z1,102)),
@@ -291,23 +291,23 @@ api_inflateSetDictionary(Config) when is_list(Config) ->
%% Test inflateSync.
api_inflateSync(Config) when is_list(Config) ->
{skip,"inflateSync/1 sucks"}.
-%% ?line Z1 = zlib:open(),
+%% Z1 = zlib:open(),
%% ?m(ok, zlib:deflateInit(Z1)),
-%% ?line B1list0 = zlib:deflate(Z1, "gurkan gurra ger galna tunnor", full),
-%% ?line B2 = zlib:deflate(Z1, "grodan boll", finish),
+%% B1list0 = zlib:deflate(Z1, "gurkan gurra ger galna tunnor", full),
+%% B2 = zlib:deflate(Z1, "grodan boll", finish),
%% io:format("~p\n", [B1list0]),
%% io:format("~p\n", [B2]),
%% ?m(ok, zlib:deflateEnd(Z1)),
-%% ?line B1 = clobber(14, list_to_binary(B1list0)),
-%% ?line Compressed = list_to_binary([B1,B2]),
-%% ?line io:format("~p\n", [Compressed]),
+%% B1 = clobber(14, list_to_binary(B1list0)),
+%% Compressed = list_to_binary([B1,B2]),
+%% io:format("~p\n", [Compressed]),
%% ?m(ok, zlib:inflateInit(Z1)),
%% ?m(?BARG, zlib:inflateSync(gurka)),
%% ?m({'EXIT',{data_error,_}}, zlib:inflate(Z1, Compressed)),
%% ?m(ok, zlib:inflateSync(Z1)),
-%% ?line Ubs = zlib:inflate(Z1, []),
-%% ?line <<"grodan boll">> = list_to_binary(Ubs),
+%% Ubs = zlib:inflate(Z1, []),
+%% <<"grodan boll">> = list_to_binary(Ubs),
%% ?m(ok, zlib:close(Z1)).
clobber(N, Bin) when is_binary(Bin) ->
@@ -320,7 +320,7 @@ clobber(N, Bin) when is_binary(Bin) ->
%% Test inflateReset.
api_inflateReset(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:inflateInit(Z1)),
?m(?BARG, zlib:inflateReset(gurka)),
?m(ok, zlib:inflateReset(Z1)),
@@ -329,8 +329,8 @@ api_inflateReset(Config) when is_list(Config) ->
%% Test inflate.
api_inflate(Config) when is_list(Config) ->
Data = [<<1,2,2,3,3,3,4,4,4,4>>],
- ?line Compressed = zlib:compress(Data),
- ?line Z1 = zlib:open(),
+ Compressed = zlib:compress(Data),
+ Z1 = zlib:open(),
?m(ok, zlib:inflateInit(Z1)),
?m([], zlib:inflate(Z1, <<>>)),
?m(Data, zlib:inflate(Z1, Compressed)),
@@ -352,9 +352,9 @@ api_inflateChunk(Config) when is_list(Config) ->
Part1 = binary:part(Data, 0, ChunkSize),
Part2 = binary:part(Data, ChunkSize, ChunkSize),
Part3 = binary:part(Data, ChunkSize * 2, ChunkSize),
- ?line Compressed = zlib:compress(Data),
- ?line Z1 = zlib:open(),
- ?line zlib:setBufSize(Z1, ChunkSize),
+ Compressed = zlib:compress(Data),
+ Z1 = zlib:open(),
+ zlib:setBufSize(Z1, ChunkSize),
?m(ok, zlib:inflateInit(Z1)),
?m([], zlib:inflateChunk(Z1, <<>>)),
?m({more, Part1}, zlib:inflateChunk(Z1, Compressed)),
@@ -367,7 +367,7 @@ api_inflateChunk(Config) when is_list(Config) ->
?m(ok, zlib:inflateReset(Z1)),
- ?line zlib:setBufSize(Z1, size(Data)),
+ zlib:setBufSize(Z1, size(Data)),
?m(Data, zlib:inflateChunk(Z1, Compressed)),
?m(ok, zlib:inflateEnd(Z1)),
@@ -379,7 +379,7 @@ api_inflateChunk(Config) when is_list(Config) ->
%% Test inflateEnd.
api_inflateEnd(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m({'EXIT',{einval,_}}, zlib:inflateEnd(Z1)),
?m(ok, zlib:inflateInit(Z1)),
?m(?BARG, zlib:inflateEnd(gurka)),
@@ -392,14 +392,14 @@ api_inflateEnd(Config) when is_list(Config) ->
%% Test getBufsz.
api_getBufsz(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(Val when is_integer(Val), zlib:getBufSize(Z1)),
?m(?BARG, zlib:getBufSize(gurka)),
?m(ok, zlib:close(Z1)).
%% Test setBufsz.
api_setBufsz(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(?BARG, zlib:setBufSize(Z1, gurka)),
?m(?BARG, zlib:setBufSize(gurka, 1232330)),
Sz = ?m( Val when is_integer(Val), zlib:getBufSize(Z1)),
@@ -411,7 +411,7 @@ api_setBufsz(Config) when is_list(Config) ->
%%% Debug function ??
%% Test getQSize.
api_getQSize(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
Q = ?m(Val when is_integer(Val), zlib:getQSize(Z1)),
io:format("QSize ~p ~n", [Q]),
?m(?BARG, zlib:getQSize(gurka)),
@@ -419,13 +419,13 @@ api_getQSize(Config) when is_list(Config) ->
%% Test crc32.
api_crc32(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1,best_speed,deflated,-15,8,default)),
Bin = <<1,1,1,1,1,1,1,1,1>>,
Compressed1 = ?m(_, zlib:deflate(Z1, Bin, none)),
Compressed2 = ?m(_, zlib:deflate(Z1, <<>>, finish)),
Compressed = list_to_binary(Compressed1 ++ Compressed2),
- CRC1 = ?m( CRC1 when is_integer(CRC1), zlib:crc32(Z1)),
+ CRC1 = ?m( CRC1 when is_integer(CRC1), zlib:crc32(Z1)),
?m(CRC1 when is_integer(CRC1), zlib:crc32(Z1,Bin)),
?m(CRC1 when is_integer(CRC1), zlib:crc32(Z1,binary_to_list(Bin))),
?m(CRC2 when is_integer(CRC2), zlib:crc32(Z1,Compressed)),
@@ -445,7 +445,7 @@ api_crc32(Config) when is_list(Config) ->
%% Test adler32.
api_adler32(Config) when is_list(Config) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
?m(ok, zlib:deflateInit(Z1,best_speed,deflated,-15,8,default)),
Bin = <<1,1,1,1,1,1,1,1,1>>,
Compressed1 = ?m(_, zlib:deflate(Z1, Bin, none)),
@@ -470,7 +470,7 @@ api_adler32(Config) when is_list(Config) ->
api_un_compress(Config) when is_list(Config) ->
?m(?BARG,zlib:compress(not_a_binary)),
Bin = <<1,11,1,23,45>>,
- ?line Comp = zlib:compress(Bin),
+ Comp = zlib:compress(Bin),
?m(?BARG,zlib:uncompress(not_a_binary)),
?m({'EXIT',{data_error,_}}, zlib:uncompress(<<171,171,171,171,171>>)),
?m({'EXIT',{data_error,_}}, zlib:uncompress(<<>>)),
@@ -486,14 +486,14 @@ api_un_compress(Config) when is_list(Config) ->
api_un_zip(Config) when is_list(Config) ->
?m(?BARG,zlib:zip(not_a_binary)),
Bin = <<1,11,1,23,45>>,
- ?line Comp = zlib:zip(Bin),
+ Comp = zlib:zip(Bin),
?m(Comp, zlib:zip(binary_to_list(Bin))),
?m(?BARG,zlib:unzip(not_a_binary)),
?m({'EXIT',{data_error,_}}, zlib:unzip(<<171,171,171,171,171>>)),
?m({'EXIT',{data_error,_}}, zlib:unzip(<<>>)),
?m(Bin, zlib:unzip(Comp)),
?m(Bin, zlib:unzip(binary_to_list(Comp))),
-
+
%% OTP-6396
B = <<131,104,19,100,0,13,99,95,99,105,100,95,99,115,103,115,110,95,50,97,1,107,0,4,208,161,246,29,107,0,3,237,166,224,107,0,6,66,240,153,0,2,10,1,0,8,97,116,116,97,99,104,101,100,104,2,100,0,22,117,112,100,97,116,101,95,112,100,112,95,99,111,110,116,101,120,116,95,114,101,113,107,0,114,69,3,12,1,11,97,31,113,150,64,104,132,61,64,104,12,3,197,31,113,150,64,104,132,61,64,104,12,1,11,97,31,115,150,64,104,116,73,64,104,0,0,0,0,0,0,65,149,16,61,65,149,16,61,1,241,33,4,5,0,33,4,4,10,6,10,181,4,10,6,10,181,38,15,99,111,109,109,97,110,100,1,114,45,97,112,110,45,49,3,99,111,109,5,109,110,99,57,57,6,109,99,99,50,52,48,4,103,112,114,115,8,0,104,2,104,2,100,0,8,97,99,116,105,118,97,116,101,104,23,100,0,11,112,100,112,95,99,111,110,116,1,120,116,100,0,7,112,114,105,109,97,114,121,97,1,100,0,9,117,110,100,101,102,105,110,101,100,97,1,97,4,97,4,97,7,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,110,10100,100,0,9,117,110,100,101,102,105,110,101,100,100,0,5,102,97,108,115,101,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,1,101,100,97,0,100,0,9,117,110,100,101,102,105,110,101,100,107,0,4,16,0,1,144,107,0,4,61,139,186,181,107,0,4,10,8,201,49,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,0,101,100,100,0,9,117,110,100,101,102,105,110,101,100,104,2,104,3,98,0,0,7,214,97,11,97,20,104,3,97,17,97,16,97,21,106,108,0,0,0,3,104,2,97,1,104,2,104,3,98,0,0,7,214,97,11,97,20,104,3,97,17,97,167,20,104,2,97,4,104,2,104,3,98,0,0,7,214,97,11,97,20,104,3,97,17,97,16,97,21,104,2,97,10,104,2,104,3,98,0,0,7,214,97,11,97,20,104,3,97,17,97,16,97,26,106,100,0,5,118,101,114,57,57,100,0,9,117,110,0,101,102,105,110,101,100,107,0,2,0,244,107,0,4,10,6,102,195,107,0,4,10,6,102,195,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,110,101,100,107,0,125,248,143,0,203,25115,157,116,65,185,65,172,55,87,164,88,225,50,203,251,115,157,116,65,185,65,172,55,87,164,88,225,50,0,0,82,153,50,0,200,98,87,148,237,193,185,65,149,167,69,144,14,16,153,50,3,81,70,94,13,109,193,1,120,5,181,113,198,118,50,3,81,70,94,13,109,193,185,120,5,181,113,198,118,153,3,81,70,94,13,109,193,185,120,5,181,113,198,118,153,50,16,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,113,92,2,119,128,0,0,108,0,0,1,107,0,114,69,3,12,1,11,97,31,113,150,64,104,132,61,64,104,12,3,11,97,31,113,150,64,104,132,61,64,104,12,1,11,97,31,115,150,64,104,116,73,64,104,0,0,0,0,0,0,65,149,16,61,65,149,16,61,1,241,33,4,0,33,4,4,10,6,10,181,4,10,6,10,181,38,15,99,111,109,109,97,110,100,101,114,45,97,112,110,45,49,3,99,111,109,5,109,110,99,57,57,6,109,99,99,50,52,48,4,103,112,114,115,8,0,106>>,
Z = zlib:zip(B),
@@ -503,19 +503,19 @@ api_un_zip(Config) when is_list(Config) ->
api_g_un_zip(Config) when is_list(Config) ->
?m(?BARG,zlib:gzip(not_a_binary)),
Bin = <<1,11,1,23,45>>,
- ?line Comp = zlib:gzip(Bin),
+ Comp = zlib:gzip(Bin),
?m(Comp, zlib:gzip(binary_to_list(Bin))),
?m(?BARG, zlib:gunzip(not_a_binary)),
?m(?DATA_ERROR, zlib:gunzip(<<171,171,171,171,171>>)),
?m(?DATA_ERROR, zlib:gunzip(<<>>)),
?m(Bin, zlib:gunzip(Comp)),
?m(Bin, zlib:gunzip(binary_to_list(Comp))),
-
+
%% Bad CRC; bad length.
BadCrc = bad_crc_data(),
- ?line ?m({'EXIT',{data_error,_}},(catch zlib:gunzip(BadCrc))),
+ ?m({'EXIT',{data_error,_}},(catch zlib:gunzip(BadCrc))),
BadLen = bad_len_data(),
- ?line ?m({'EXIT',{data_error,_}},(catch zlib:gunzip(BadLen))),
+ ?m({'EXIT',{data_error,_}},(catch zlib:gunzip(BadLen))),
ok.
bad_crc_data() ->
@@ -532,24 +532,24 @@ intro(Config) when is_list(Config) ->
[put({ex, N}, <<"This is a binary">>) || N <- [0,1,2,3,4]],
put({ex, 5}, end_of_data),
put(ex,0),
- ?line Read = fun() ->
- N = get(ex),
- put(ex,N+1),
- get({ex,N})
- end,
-
- ?line Z = zlib:open(),
- ?line ok = zlib:deflateInit(Z,default),
-
- ?line Compress = fun(end_of_data, _Cont) -> [];
- (Data, Cont) ->
- [zlib:deflate(Z, Data)|Cont(Read(),Cont)]
- end,
- ?line Compressed = Compress(Read(),Compress),
- ?line Last = zlib:deflate(Z, [], finish),
- ?line ok = zlib:deflateEnd(Z),
- ?line zlib:close(Z),
- ?line Res = list_to_binary([Compressed|Last]),
+ Read = fun() ->
+ N = get(ex),
+ put(ex,N+1),
+ get({ex,N})
+ end,
+
+ Z = zlib:open(),
+ ok = zlib:deflateInit(Z,default),
+
+ Compress = fun(end_of_data, _Cont) -> [];
+ (Data, Cont) ->
+ [zlib:deflate(Z, Data)|Cont(Read(),Cont)]
+ end,
+ Compressed = Compress(Read(),Compress),
+ Last = zlib:deflate(Z, [], finish),
+ ok = zlib:deflateEnd(Z),
+ zlib:close(Z),
+ Res = list_to_binary([Compressed|Last]),
Orig = list_to_binary(lists:duplicate(5, D)),
?m(Orig, zlib:uncompress(Res)).
@@ -558,11 +558,11 @@ intro(Config) when is_list(Config) ->
large_deflate(Config) when is_list(Config) ->
large_deflate_do().
large_deflate_do() ->
- ?line Z = zlib:open(),
- ?line Plain = rand_bytes(zlib:getBufSize(Z)*5),
- ?line ok = zlib:deflateInit(Z),
- ?line _ZlibHeader = zlib:deflate(Z, [], full),
- ?line Deflated = zlib:deflate(Z, Plain, full),
+ Z = zlib:open(),
+ Plain = rand_bytes(zlib:getBufSize(Z)*5),
+ ok = zlib:deflateInit(Z),
+ _ZlibHeader = zlib:deflate(Z, [], full),
+ Deflated = zlib:deflate(Z, Plain, full),
?m(ok, zlib:close(Z)),
?m(Plain, zlib:unzip(list_to_binary([Deflated, 3, 0]))).
@@ -581,18 +581,18 @@ rand_bytes(Bin, Sz) ->
zip_usage(Config) when is_list(Config) ->
zip_usage(zip_usage({get_arg,Config}));
zip_usage({get_arg,Config}) ->
- ?line Out = conf(data_dir,Config),
- ?line {ok,ZIP} = file:read_file(filename:join(Out,"zipdoc.zip")),
- ?line {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
+ Out = conf(data_dir,Config),
+ {ok,ZIP} = file:read_file(filename:join(Out,"zipdoc.zip")),
+ {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
{run,ZIP,ORIG};
zip_usage({run,ZIP,ORIG}) ->
- ?line <<_:14/binary, CRC:32/little,
- CompSz:32/little, UnCompSz:32/little,_:31/binary,
- Compressed:CompSz/binary, _/binary>> = ZIP,
-
+ <<_:14/binary, CRC:32/little,
+ CompSz:32/little, UnCompSz:32/little,_:31/binary,
+ Compressed:CompSz/binary, _/binary>> = ZIP,
+
%%io:format("CRC ~p CSz ~p UnCSz ~p ~n", [CRC,CompSz,UnCompSz]),
- ?line Split = split_bin(Compressed,[]),
- ?line Z = zlib:open(),
+ Split = split_bin(Compressed,[]),
+ Z = zlib:open(),
?m(ok, zlib:inflateInit(Z, -15)),
Bs = [zlib:inflate(Z, Part) || Part <- Split],
@@ -602,84 +602,84 @@ zip_usage({run,ZIP,ORIG}) ->
?m(true, zlib:crc32(Z,UC0) == zlib:crc32(Z,ORIG)),
?m(ok, zlib:inflateEnd(Z)),
- ?line UC1 = zlib:unzip(Compressed),
+ UC1 = zlib:unzip(Compressed),
?m(UnCompSz, byte_size(UC1)),
?m(true, zlib:crc32(Z,UC1) == zlib:crc32(Z,ORIG)),
-
+
?m(ok, zlib:inflateInit(Z, -15)),
- ?line UC2 = zlib:inflate(Z, Compressed),
+ UC2 = zlib:inflate(Z, Compressed),
?m(UnCompSz, byte_size(list_to_binary(UC2))),
?m(CRC, zlib:crc32(Z)),
?m(true, zlib:crc32(Z,UC2) == zlib:crc32(Z,ORIG)),
?m(ok, zlib:inflateEnd(Z)),
-
+
?m(ok, zlib:inflateInit(Z, -15)),
- ?line UC3 = zlib:inflate(Z, Split), % Test multivec.
+ UC3 = zlib:inflate(Z, Split), % Test multivec.
?m(UnCompSz, byte_size(list_to_binary(UC3))),
?m(true, zlib:crc32(Z,UC3) == zlib:crc32(Z,ORIG)),
?m(CRC, zlib:crc32(Z)),
?m(ok, zlib:inflateEnd(Z)),
-
+
?m(ok, zlib:inflateInit(Z, -15)),
?m(ok, zlib:setBufSize(Z, UnCompSz *2)),
- ?line UC4 = zlib:inflate(Z, Compressed),
+ UC4 = zlib:inflate(Z, Compressed),
?m(UnCompSz, byte_size(list_to_binary(UC4))),
?m(CRC, zlib:crc32(Z)),
?m(CRC, zlib:crc32(Z,UC4)),
?m(true, zlib:crc32(Z,UC4) == zlib:crc32(Z,ORIG)),
?m(ok, zlib:inflateEnd(Z)),
-
- ?line C1 = zlib:zip(ORIG),
- ?line UC5 = zlib:unzip(C1),
+
+ C1 = zlib:zip(ORIG),
+ UC5 = zlib:unzip(C1),
?m(CRC, zlib:crc32(Z,UC5)),
?m(true,zlib:crc32(Z,UC5) == zlib:crc32(Z,ORIG)),
-
+
?m(ok, zlib:deflateInit(Z, default, deflated, -15, 8, default)),
- ?line C2 = zlib:deflate(Z, ORIG, finish),
+ C2 = zlib:deflate(Z, ORIG, finish),
?m(true, C1 == list_to_binary(C2)),
?m(ok, zlib:deflateEnd(Z)),
-
+
?m(ok, zlib:deflateInit(Z, none, deflated, -15, 8, filtered)),
?m(ok, zlib:deflateParams(Z, default, default)),
- ?line C3 = zlib:deflate(Z, ORIG, finish),
+ C3 = zlib:deflate(Z, ORIG, finish),
?m(true, C1 == list_to_binary(C3)),
?m(ok, zlib:deflateEnd(Z)),
- ?line ok = zlib:close(Z),
- ?line ok.
+ ok = zlib:close(Z),
+ ok.
%% Test a standard compressed gzipped file.
gz_usage(Config) when is_list(Config) ->
gz_usage(gz_usage({get_arg,Config}));
gz_usage({get_arg,Config}) ->
- ?line Out = conf(data_dir,Config),
- ?line {ok,GZIP} = file:read_file(filename:join(Out,"zipdoc.1.gz")),
- ?line {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
- ?line {ok,GZIP2} = file:read_file(filename:join(Out,"zipdoc.txt.gz")),
+ Out = conf(data_dir,Config),
+ {ok,GZIP} = file:read_file(filename:join(Out,"zipdoc.1.gz")),
+ {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
+ {ok,GZIP2} = file:read_file(filename:join(Out,"zipdoc.txt.gz")),
{run,GZIP,ORIG,GZIP2};
gz_usage({run,GZIP,ORIG,GZIP2}) ->
- ?line Z = zlib:open(),
- ?line UC1 = zlib:gunzip(GZIP),
+ Z = zlib:open(),
+ UC1 = zlib:gunzip(GZIP),
?m(true,zlib:crc32(Z,UC1) == zlib:crc32(Z,ORIG)),
- ?line UC3 = zlib:gunzip(GZIP2),
+ UC3 = zlib:gunzip(GZIP2),
?m(true,zlib:crc32(Z,UC3) == zlib:crc32(Z,ORIG)),
- ?line Compressed = zlib:gzip(ORIG),
- ?line UC5 = zlib:gunzip(Compressed),
+ Compressed = zlib:gzip(ORIG),
+ UC5 = zlib:gunzip(Compressed),
?m(true,zlib:crc32(Z,UC5) == zlib:crc32(Z,ORIG)),
- ?line ok = zlib:close(Z).
+ ok = zlib:close(Z).
%% Test more of a standard compressed gzipped file.
gz_usage2(Config) ->
case os:find_executable("gzip") of
Name when is_list(Name) ->
- ?line Z = zlib:open(),
- ?line Out = conf(data_dir,Config),
- ?line {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
- ?line Compressed = zlib:gzip(ORIG),
+ Z = zlib:open(),
+ Out = conf(data_dir,Config),
+ {ok,ORIG} = file:read_file(filename:join(Out,"zipdoc")),
+ Compressed = zlib:gzip(ORIG),
GzOutFile = filename:join(Out,"out.gz"),
OutFile = filename:join(Out,"out.txt"),
?m(ok, file:write_file(GzOutFile,Compressed)),
- ?line os:cmd("gzip -c -d " ++ GzOutFile ++ " > " ++ OutFile),
+ os:cmd("gzip -c -d " ++ GzOutFile ++ " > " ++ OutFile),
case file:read_file(OutFile) of
{ok,ExtDecompressed} ->
?m(true,
@@ -688,12 +688,12 @@ gz_usage2(Config) ->
io:format("Couldn't test external decompressor ~p\n",
[Error])
end,
- ?line ok = zlib:close(Z),
+ ok = zlib:close(Z),
ok;
false ->
{skipped,"No gzip in path"}
end.
-
+
%% Test that (de)compress funcs work with standard tools, for example
@@ -701,67 +701,67 @@ gz_usage2(Config) ->
compress_usage(Config) when is_list(Config) ->
compress_usage(compress_usage({get_arg,Config}));
compress_usage({get_arg,Config}) ->
- ?line Out = conf(data_dir,Config),
- ?line {ok,C1} = file:read_file(filename:join(Out,"png-compressed.zlib")),
+ Out = conf(data_dir,Config),
+ {ok,C1} = file:read_file(filename:join(Out,"png-compressed.zlib")),
{run,C1};
compress_usage({run,C1}) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
%% See that we can uncompress a file generated with external prog.
- ?line UC1 = zlib:uncompress(C1),
+ UC1 = zlib:uncompress(C1),
%% Check that the crc are correct.
?m(4125865008,zlib:crc32(Z,UC1)),
- ?line C2 = zlib:compress(UC1),
- ?line UC2 = zlib:uncompress(C2),
+ C2 = zlib:compress(UC1),
+ UC2 = zlib:uncompress(C2),
%% Check that the crc are correct.
?m(4125865008,zlib:crc32(Z,UC2)),
-
- ?line ok = zlib:close(Z),
+
+ ok = zlib:close(Z),
D = [<<"We tests some partial">>,
<<"data, sent over">>,
<<"the stream">>,
<<"we check that we can unpack">>,
<<"every message we get">>],
-
- ?line ZC = zlib:open(),
- ?line ZU = zlib:open(),
+
+ ZC = zlib:open(),
+ ZU = zlib:open(),
Test = fun(finish, {_,Tot}) ->
- ?line Compressed = zlib:deflate(ZC, <<>>, finish),
+ Compressed = zlib:deflate(ZC, <<>>, finish),
Data = zlib:inflate(ZU, Compressed),
[Tot|Data];
(Data, {Op,Tot}) ->
- ?line Compressed = zlib:deflate(ZC, Data, Op),
+ Compressed = zlib:deflate(ZC, Data, Op),
Res1 = ?m([Data],zlib:inflate(ZU, Compressed)),
{Op, [Tot|Res1]}
end,
- ?line zlib:deflateInit(ZC),
- ?line zlib:inflateInit(ZU),
- ?line T1 = lists:foldl(Test,{sync,[]},D++[finish]),
+ zlib:deflateInit(ZC),
+ zlib:inflateInit(ZU),
+ T1 = lists:foldl(Test,{sync,[]},D++[finish]),
?m(true, list_to_binary(D) == list_to_binary(T1)),
- ?line zlib:deflateEnd(ZC),
- ?line zlib:inflateEnd(ZU),
-
- ?line zlib:deflateInit(ZC),
- ?line zlib:inflateInit(ZU),
- ?line T2 = lists:foldl(Test,{full,[]},D++[finish]),
+ zlib:deflateEnd(ZC),
+ zlib:inflateEnd(ZU),
+
+ zlib:deflateInit(ZC),
+ zlib:inflateInit(ZU),
+ T2 = lists:foldl(Test,{full,[]},D++[finish]),
?m(true, list_to_binary(D) == list_to_binary(T2)),
- ?line zlib:deflateEnd(ZC),
- ?line zlib:inflateEnd(ZU),
-
- ?line ok = zlib:close(ZC),
- ?line ok = zlib:close(ZU).
+ zlib:deflateEnd(ZC),
+ zlib:inflateEnd(ZU),
+
+ ok = zlib:close(ZC),
+ ok = zlib:close(ZU).
%% Check that crc works as expected.
crc(Config) when is_list(Config) ->
crc(crc({get_arg,Config}));
crc({get_arg,Config}) ->
- ?line Out = conf(data_dir,Config),
- ?line {ok,C1} = file:read_file(filename:join(Out,"zipdoc")),
+ Out = conf(data_dir,Config),
+ {ok,C1} = file:read_file(filename:join(Out,"zipdoc")),
{run,C1};
crc({run,C1}) ->
- ?line Z = zlib:open(),
- ?line Crc = zlib:crc32(Z, C1),
+ Z = zlib:open(),
+ Crc = zlib:crc32(Z, C1),
Bins = split_bin(C1,[]),
%%io:format("Length ~p ~p ~n", [length(Bins), [size(Bin) || Bin <- Bins]]),
Last = lists:last(Bins),
@@ -771,28 +771,28 @@ crc({run,C1}) ->
Crc1
end, 0, Bins),
?m(Crc,SCrc),
- ?line [First|Rest] = Bins,
+ [First|Rest] = Bins,
Combine = fun(Bin, CS1) ->
CS2 = zlib:crc32(Z, Bin),
S2 = byte_size(Bin),
zlib:crc32_combine(Z,CS1,CS2,S2)
end,
- ?line Comb = lists:foldl(Combine, zlib:crc32(Z, First), Rest),
+ Comb = lists:foldl(Combine, zlib:crc32(Z, First), Rest),
?m(Crc,Comb),
- ?line ok = zlib:close(Z).
+ ok = zlib:close(Z).
%% Check that adler works as expected.
adler(Config) when is_list(Config) ->
adler(adler({get_arg,Config}));
adler({get_arg,Config}) ->
- ?line Out = conf(data_dir,Config),
+ Out = conf(data_dir,Config),
File1 = filename:join(Out,"zipdoc"),
- ?line {ok,C1} = file:read_file(File1),
+ {ok,C1} = file:read_file(File1),
{run,C1};
adler({run,C1}) ->
- ?line Z = zlib:open(),
+ Z = zlib:open(),
?m(1, zlib:adler32(Z,<<>>)),
- ?line Crc = zlib:adler32(Z, C1),
+ Crc = zlib:adler32(Z, C1),
Bins = split_bin(C1,[]),
Last = lists:last(Bins),
SCrc = lists:foldl(fun(Bin,Crc0) ->
@@ -801,15 +801,15 @@ adler({run,C1}) ->
Crc1
end, zlib:adler32(Z,<<>>), Bins),
?m(Crc,SCrc),
- ?line [First|Rest] = Bins,
+ [First|Rest] = Bins,
Combine = fun(Bin, CS1) ->
CS2 = zlib:adler32(Z, Bin),
S2 = byte_size(Bin),
zlib:adler32_combine(Z,CS1,CS2,S2)
end,
- ?line Comb = lists:foldl(Combine, zlib:adler32(Z, First), Rest),
+ Comb = lists:foldl(Combine, zlib:adler32(Z, First), Rest),
?m(Crc,Comb),
- ?line ok = zlib:close(Z).
+ ok = zlib:close(Z).
%% Test dictionary usage.
dictionary_usage(Config) when is_list(Config) ->
@@ -817,26 +817,26 @@ dictionary_usage(Config) when is_list(Config) ->
dictionary_usage({get_arg,_Config}) ->
{run}; % no args
dictionary_usage({run}) ->
- ?line Z1 = zlib:open(),
+ Z1 = zlib:open(),
Dict = <<"Anka">>,
Data = <<"Kalle Anka">>,
?m(ok, zlib:deflateInit(Z1)),
- ?line DictID = zlib:deflateSetDictionary(Z1, Dict),
- %% ?line io:format("DictID = ~p\n", [DictID]),
- ?line B1 = zlib:deflate(Z1, Data),
- ?line B2 = zlib:deflate(Z1, <<>>, finish),
+ DictID = zlib:deflateSetDictionary(Z1, Dict),
+ %% io:format("DictID = ~p\n", [DictID]),
+ B1 = zlib:deflate(Z1, Data),
+ B2 = zlib:deflate(Z1, <<>>, finish),
?m(ok, zlib:deflateEnd(Z1)),
?m(ok, zlib:close(Z1)),
Compressed = list_to_binary([B1,B2]),
%% io:format("~p\n", [Compressed]),
%% Now uncompress.
- ?line Z2 = zlib:open(),
+ Z2 = zlib:open(),
?m(ok, zlib:inflateInit(Z2)),
- ?line {'EXIT',{{need_dictionary,DictID},_}} = (catch zlib:inflate(Z2, Compressed)),
+ {'EXIT',{{need_dictionary,DictID},_}} = (catch zlib:inflate(Z2, Compressed)),
?m(ok, zlib:inflateSetDictionary(Z2, Dict)),
?m(ok, zlib:inflateSetDictionary(Z2, binary_to_list(Dict))),
- ?line Uncompressed = ?m(B when is_list(B), zlib:inflate(Z2, [])),
+ Uncompressed = ?m(B when is_list(B), zlib:inflate(Z2, [])),
?m(ok, zlib:inflateEnd(Z2)),
?m(ok, zlib:close(Z2)),
?m(Data, list_to_binary(Uncompressed)).
@@ -872,7 +872,7 @@ smp(Config) ->
false ->
{skipped,"No smp support"}
end.
-
+
worker(Seed, FnATpl, Parent) ->
io:format("smp worker ~p, seed=~p~n",[self(),Seed]),
@@ -887,13 +887,13 @@ worker_loop(N, FnATpl) ->
{F,A} = element(rand:uniform(tuple_size(FnATpl)), FnATpl),
?MODULE:F(A),
worker_loop(N-1, FnATpl).
-
+
wait_pids([]) ->
ok;
wait_pids(Pids) ->
receive
Pid ->
- ?line true = lists:member(Pid,Pids),
+ true = lists:member(Pid,Pids),
Others = lists:delete(Pid,Pids),
io:format("wait_pid got ~p, still waiting for ~p\n",[Pid,Others]),
wait_pids(Others)
@@ -907,9 +907,9 @@ otp_7359(_Config) ->
ok = zlib:deflateInit(ZTry),
ISize = zlib:getBufSize(ZTry),
IData = list_to_binary([Byte band 255 || Byte <- lists:seq(1,ISize)]),
- ?line ISize = byte_size(IData),
+ ISize = byte_size(IData),
- ?line DSize = iolist_size(zlib:deflate(ZTry, IData, sync)),
+ DSize = iolist_size(zlib:deflate(ZTry, IData, sync)),
zlib:close(ZTry),
io:format("Deflated try ~p -> ~p bytes~n", [ISize, DSize]),
@@ -931,19 +931,19 @@ otp_7359(_Config) ->
otp_7359_def_inf(Data,{DefSize,InfSize}) ->
%%io:format("Try: DefSize=~p InfSize=~p~n", [DefSize,InfSize]),
- ?line ZDef = zlib:open(),
- ?line ok = zlib:deflateInit(ZDef),
- ?line ok = zlib:setBufSize(ZDef,DefSize),
- ?line DefData = iolist_to_binary(zlib:deflate(ZDef, Data, sync)),
+ ZDef = zlib:open(),
+ ok = zlib:deflateInit(ZDef),
+ ok = zlib:setBufSize(ZDef,DefSize),
+ DefData = iolist_to_binary(zlib:deflate(ZDef, Data, sync)),
%%io:format("Deflated ~p(~p) -> ~p(~p) bytes~n",
%% [byte_size(Data), InfSize, byte_size(DefData), DefSize]),
- ?line ok = zlib:close(ZDef),
+ ok = zlib:close(ZDef),
- ?line ZInf = zlib:open(),
- ?line ok = zlib:inflateInit(ZInf),
- ?line ok = zlib:setBufSize(ZInf,InfSize),
- ?line Data = iolist_to_binary(zlib:inflate(ZInf, DefData)),
- ?line ok = zlib:close(ZInf),
+ ZInf = zlib:open(),
+ ok = zlib:inflateInit(ZInf),
+ ok = zlib:setBufSize(ZInf,InfSize),
+ Data = iolist_to_binary(zlib:inflate(ZInf, DefData)),
+ ok = zlib:close(ZInf),
ok.
otp_9981(Config) when is_list(Config) ->
@@ -963,7 +963,7 @@ otp_9981(Config) when is_list(Config) ->
Ports = lists:sort(erlang:ports()),
ok.
-
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Helps with testing directly %%%%%%%%%%%%%