diff options
Diffstat (limited to 'lib/asn1/test')
-rw-r--r-- | lib/asn1/test/asn1_SUITE.erl | 15 | ||||
-rw-r--r-- | lib/asn1/test/testTimer.erl | 19 | ||||
-rw-r--r-- | lib/asn1/test/test_special_decode_performance.erl | 6 |
3 files changed, 27 insertions, 13 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 66cfdfa629..1f13faa220 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -67,6 +67,7 @@ groups() -> {parallel, parallel([]), [cover, + xref, {group, ber}, % Uses 'P-Record', 'Constraints', 'MEDIA-GATEWAY-CONTROL'... {group, [], [parse, @@ -1269,3 +1270,17 @@ ticket7904(Config) -> {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1), {ok,_} = 'RANAPextract1':encode('InitiatingMessage', Val1). + +xref(_Config) -> + xref:start(s), + xref:set_default(s, [{verbose,false},{warnings,false},{builtins,true}]), + Test = filename:dirname(code:which(?MODULE)), + {ok,_PMs} = xref:add_directory(s, Test), + UnusedExports = "X - XU - asn1_appup_test - asn1_app_test - \".*_SUITE\" : Mod", + case xref:q(s, UnusedExports) of + {ok,[]} -> + ok; + {ok,[_|_]=Res} -> + io:format("Exported, but unused: ~p\n", [Res]), + ?t:fail() + end. diff --git a/lib/asn1/test/testTimer.erl b/lib/asn1/test/testTimer.erl index 9231ff4a66..0f02bab6e0 100644 --- a/lib/asn1/test/testTimer.erl +++ b/lib/asn1/test/testTimer.erl @@ -18,7 +18,7 @@ %% %% -module(testTimer). --export([go/2,encode/4,decode/5]). +-export([go/2]). -include_lib("test_server/include/test_server.hrl"). @@ -125,7 +125,7 @@ val() -> {'H323-UserInformation_user-data',24,"O"}}. -go(Config,Enc) -> +go(Config, _Enc) -> ?line true = code:add_patha(?config(priv_dir,Config)), Module = 'H323-MESSAGES', @@ -135,13 +135,12 @@ go(Config,Enc) -> CompileOptions = compile_options(), - ?line {ValWr, done} = timer:tc(?MODULE, encode, [?times, Module, Type, Value]), + {ValWr,done} = timer:tc(fun() -> encode(?times, Module, Type, Value) end), ?line io:format("ASN1 encode ~p: ~p micro~n", [CompileOptions, ValWr / ?times]), - ?line done = decode(2,Module,Type,Bytes,Enc), + done = decode(2, Module, Type, Bytes), - ?line {ValRead, done} = timer:tc(?MODULE, decode, [?times, Module, - Type, Bytes,Enc]), + {ValRead,done} = timer:tc(fun() -> decode(?times, Module, Type, Bytes) end), ?line io:format("ASN1 decode ~p: ~p micro~n", [CompileOptions, ValRead /?times]), @@ -160,11 +159,11 @@ encode(N, Module,Type,Value) -> end, encode(N-1, Module,Type,Value). -decode(0, _Module,_Type,_Value,_Erule) -> +decode(0, _Module, _Type, _Value) -> done; -decode(N, Module,Type,Value,Erule) -> - {ok,_B} = asn1rt:decode(Module,Type,Value), - decode(N-1, Module,Type,Value,Erule). +decode(N, Module, Type, Value) -> + {ok,_B} = asn1rt:decode(Module, Type, Value), + decode(N-1, Module, Type, Value). compile_options() -> {ok,Info} = asn1rt:info('H323-MESSAGES'), diff --git a/lib/asn1/test/test_special_decode_performance.erl b/lib/asn1/test/test_special_decode_performance.erl index 7dfab1f25a..0f52ae4cd2 100644 --- a/lib/asn1/test/test_special_decode_performance.erl +++ b/lib/asn1/test/test_special_decode_performance.erl @@ -19,7 +19,7 @@ %% -module(test_special_decode_performance). --export([go/1,loop2/4,loop1/5]). +-export([go/1]). -include_lib("test_server/include/test_server.hrl"). @@ -49,7 +49,7 @@ go1(_,_,[],_,_,AccTime) -> %% go1 for common decode go1(common,Mod,_,Bin,N,_) -> ?line TT=get_top_type(Mod), - ?line {Time,Result}=timer:tc(?MODULE,loop1,[Mod,decode,TT,Bin,N]), + {Time,Result} = timer:tc(fun() -> loop1(Mod, decode, TT, Bin, N) end), case Result of {ok,_R1} -> io:format("common Decode ~p:decode, ~p times on time ~p~n", @@ -59,7 +59,7 @@ go1(common,Mod,_,Bin,N,_) -> end, Time; go1(Dec,Mod,[F|Fs],Bin,N,AccTime) -> - ?line {Time,Result}=timer:tc(?MODULE,loop2,[Mod,F,Bin,N]), + {Time,Result}=timer:tc(fun() -> loop2(Mod, F, Bin, N) end), case Result of {ok,_R1} -> io:format("~p Decode ~p:~p, ~p times on time ~p~n",[Dec,Mod,F,N,Time]); |