⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 megaco_codec_prev3c_test.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
ber_bin_test_msgs(suite) ->    [];ber_bin_test_msgs(Config) when list(Config) ->    ?ACQUIRE_NODES(1, Config),    Msgs = 	msgs1a(binary) ++ 	msgs5(binary) ++ 	msgs6(binary) ++ 	msgs7(binary),    DynamicDecode = true,    test_msgs(megaco_ber_bin_encoder, DynamicDecode, ?EC, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%per_test_msgs(suite) ->    [];per_test_msgs(Config) when list(Config) ->    ?ACQUIRE_NODES(1, Config),    Msgs = 	msgs1a(binary) ++ 	msgs5(binary) ++ 	msgs6(binary) ++ 	msgs7(binary),    DynamicDecode = false,    test_msgs(megaco_per_encoder, DynamicDecode, ?EC, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%per_bin_test_msgs(suite) ->    [];per_bin_test_msgs(Config) when list(Config) ->    ?ACQUIRE_NODES(1, Config),    Msgs = 	msgs1a(binary) ++ 	msgs5(binary) ++ 	msgs6(binary) ++ 	msgs7(binary),    DynamicDecode = false,    test_msgs(megaco_per_bin_encoder, DynamicDecode, ?EC, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%erl_dist_m_test_msgs(suite) ->    [];erl_dist_m_test_msgs(Config) when list(Config) ->    ?ACQUIRE_NODES(1, Config),    Msgs = 	msgs1a(erlang) ++ 	msgs1b(erlang) ++ 	msgs3525(erlang) ++ 	msgs5(erlang) ++ 	msgs6(erlang) ++ 	msgs7(erlang),    DynamicDecode = false,    Conf = [megaco_compressed],     test_msgs(megaco_erl_dist_encoder, DynamicDecode, Conf, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #%% Ticket test cases:%% --------------------------------------------------------------%% Observe that this decode SHALL failcompact_otp4011_msg1(suite) ->    [];compact_otp4011_msg1(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp4011_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SR}}}}}",    ok = compact_otp4011(M),    %%     erase(severity),    %%     erase(dbg),    ok.%% --------------------------------------------------------------%% Observe that this decode SHALL failcompact_otp4011_msg2(suite) ->    [];compact_otp4011_msg2(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp4011_msg2 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SO,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SR}}}}}",    ok = compact_otp4011(M),    %%     erase(severity),    %%     erase(dbg),    ok.%% --------------------------------------------------------------%% Observe that this decode SHALL fail%% compact_otp4011_msg3(suite) ->    [];compact_otp4011_msg3(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp4011_msg3 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SO}}}}}",    ok = compact_otp4011(M),    %%     erase(severity),    %%     erase(dbg),    ok.compact_otp4011(Msg) ->    compact_otp4011(Msg, ?EC).compact_otp4011(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(Reason) when is_list(Reason) ->		     compact_otp4011_chk1(Reason);		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).		     compact_otp4011_chk1(R1) ->    case lists:keysearch(reason, 1, R1) of	{value, {reason, R2}} ->	    compact_otp4011_chk2(R2);	false ->	    {error, {unexpected_result, R1}}    end.	    compact_otp4011_chk2({0, ParserMod, {ParserFunc, [A, B]}})   when (ParserMod  == megaco_text_parser_prev3c) and       (ParserFunc == do_merge_control_streamParms) and       is_list(A) and       is_record(B, 'LocalControlDescriptor') ->    SM = B#'LocalControlDescriptor'.streamMode,     case lists:keysearch(mode, 1, A) of	{value, {mode, _Mode}} when SM /= asn1_NOVALUE ->	    ok;	{value, {mode, _Mode}} ->	    {error, {unexpected_streamMode_reason, {A, B}}};	false ->	    {error, {unexpected_mode_reason, {A, B}}}    end;compact_otp4011_chk2(Bad) ->    {error, {unexpected_reason, Bad}}.%% --------------------------------------------------------------%% Note that this decode SHALL fail, because of the misspelled%% MEGCAO instead of the correct MEGACO.compact_otp4013_msg1(suite) ->    [];compact_otp4013_msg1(Config) when list(Config) ->    %%     put(severity,trc),    %%     put(dbg,true),    d("compact_otp4013_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = "MEGCAO/3 MG1 T=12345678{C=-{SC=root{SV{MT=RS,RE=901}}}}",    ok = compact_otp4013(M),    %%     erase(severity),    %%     erase(dbg),    ok.compact_otp4013(Msg) ->    compact_otp4013(Msg, ?EC).compact_otp4013(Msg, Conf) ->        Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(Reason) when is_list(Reason) ->		     compact_otp4013_chk1(Reason);		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).compact_otp4013_chk1(Reason) ->    case lists:keysearch(reason, 1, Reason) of	{value, {reason, no_version_found, _}} ->	    case lists:keysearch(token, 1, Reason) of		{value, {token, [{'SafeChars',_,"megcao/3"}|_]}} ->		    ok;		{value, {token, Tokens}} ->		    {error, {unexpected_tokens, Tokens}};		false ->		    {error, {tokens_not_found, Reason}}	    end;	{value, {reason, BadReason, _}} ->	    {error, {unexpected_reason, BadReason}};	false ->	    {error, {reason_not_found, Reason}}    end.%% --------------------------------------------------------------%% %% compact_otp4085_msg1(suite) ->    [];compact_otp4085_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4085_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = compact_otp4085_erroneous_msg(),    ok = compact_otp4085_1(M),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4085_1(Msg) ->    compact_otp4085_1(Msg, ?EC).compact_otp4085_1(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(Reason) when is_list(Reason) ->		     compact_otp4085_1_chk1(Reason);		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).compact_otp4085_1_chk1(Reason) ->    case lists:keysearch(reason, 1, Reason) of	{value, {reason, {Line, Module, Crap}}} when is_integer(Line) and 						     is_atom(Module) ->	    Crap2 = 		case (catch lists:flatten(Crap)) of		    L when is_list(L) ->			L;		    _ ->			Crap		end,	    t("compact_otp4085_1_chk1 -> Expected: "	      "~n   Line:   ~p"	      "~n   Module: ~p"	      "~n   Crap2:  ~p", [Line, Module, Crap2]),	    ok;	{value, BadReason} -> 	    e("compact_otp4085_1_chk1 -> error: "	      "~n   BadReason:   ~p", [BadReason]),	    {error, {unexpected_reason, Reason}};	false ->	    {error, {reason_not_found, Reason}}    end.%% --------------------------------------------------------------%% This test case is just to show that the message used in%% compact_otp4085_msg1 is actually ok when you add '}' at the end.compact_otp4085_msg2(suite) ->    [];compact_otp4085_msg2(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4085_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = compact_otp4085_erroneous_msg() ++ "}",    ok = compact_otp4085_2(M),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4085_2(Msg) ->    compact_otp4085_2(Msg, ?EC).compact_otp4085_2(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(M) when is_record(M, 'MegacoMessage') ->		     ok;		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).%% This message lack the ending parentesis (}).compact_otp4085_erroneous_msg() ->    M = "!/" 	?VERSION_STR 	" ML T=11223342{C=${A=${M{O{MO=SR,RV=OFF,RG=OFF},L{v=0,"	"c=ATM NSAP $ ,"	"a=eecid:$ ,"	"m=audio - AAL1/ATMF -,"	"}}},A=stee1181/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=off}}}}",    M.%% --------------------------------------------------------------%% %% compact_otp4280_msg1(suite) ->    [];compact_otp4280_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4280_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    M = compact_otp4280_msg(),    ok = compact_otp4280(M),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4280(Msg) ->    compact_otp4280(Msg, ?EC).compact_otp4280(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(M) when is_record(M, 'MegacoMessage') ->		     ok;		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).    compact_otp4280_msg() ->    M = "!/"	?VERSION_STR	" mgw1 P=71853646{C=-{AV=root{M{TS{root/maxnumberofcontexts=49500,"	"root/maxterminationspercontext=2,root/normalmgexecutiontime=200,"	"root/normalmgcexecutiontime=150,"	"root/provisionalresponsetimervalue=2000,BF=OFF,SI=IV}}}}}",    M.%% --------------------------------------------------------------%% This ticket is about comments in a message%% compact_otp4299_msg1(suite) ->    [];compact_otp4299_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4299_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Msg = compact_otp4299_msg(),    ok = compact_otp4299(Msg),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4299(Msg) ->    compact_otp4299(Msg, ?EC).compact_otp4299(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(M) when is_record(M, 'MegacoMessage') ->		     ok;		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).compact_otp4299_msg() ->    M = ";KALLE\n"	"!/"	?VERSION_STR	" mg58_1 P=005197711{; YET ANOTHER COMMENT\n"	"C=035146207{A=mg58_1_1_4_1_23/19; BEFORE COMMA\n"	",; AFTER COMMA\n"	"A=eph58_1/0xA4023371{M{L{\n"	"v=0\n"	"c=ATM NSAP 39.0102.0304.0506.0708.090a.0b58.0100.0000.0000.00\n"	"m=audio - AAL1/ATMF -\n"	"a=eecid:A4023371\n"	"}}; HOBBE\n}; KALLE \"HOBBE \n}}"	";KALLE\n\n",    M.%% --------------------------------------------------------------%% compact_otp4359_msg1(suite) ->    [];compact_otp4359_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4359_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    Msg = compact_otp4359_msg(),     ok = compact_otp4359(Msg),     %% erase(severity),    %% erase(dbg),    ok.compact_otp4359_msg() ->    M = "!/" ?VERSION_STR " ml2 T={C=${A=${M{O {MO=SR,RG=OFF,RV=OFF}}}}}",    M.compact_otp4359(Msg) ->    compact_otp4359(Msg, ?EC).compact_otp4359(Msg, Conf) ->    Codec  = megaco_compact_text_encoder,    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,    Check  = fun(M) when is_record(M, 'MegacoMessage') ->		     compact_otp4359_chk(M);		(Crap) ->		     {error, {unexpected_decode_result, Crap}}	     end,    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).    compact_otp4359_chk(#'MegacoMessage'{mess = Mess}) ->    case Mess#'Message'.messageBody of	{transactions, Trans} ->	    case Trans of		[{transactionRequest, TR}] ->		    case TR of			#'TransactionRequest'{transactionId = asn1_NOVALUE} ->			    ok;			_ ->			    {error, {unexpected_trans_req, TR}}		    end;		_ ->		    {error, {unexpected_trans, Trans}}	    end;	Body ->	    {error, {unexpected_messageBody, Body}}    end.%% --------------------------------------------------------------%% compact_otp4920_msg0(suite) ->    [];compact_otp4920_msg0(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4920_msg0 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg0() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4920_msg1(suite) ->    [];compact_otp4920_msg1(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4920_msg1 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg1() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4920_msg2(suite) ->    [];compact_otp4920_msg2(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4920_msg2 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg2() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4920_msg3(suite) ->    [];compact_otp4920_msg3(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),    d("compact_otp4920_msg3 -> entry", []),    ?ACQUIRE_NODES(1, Config),    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg3() ),    %% erase(severity),    %% erase(dbg),    ok.compact_otp4920_msg4(suite) ->    [];compact_otp4920_msg4(Config) when list(Config) ->    %% put(severity,trc),    %% put(dbg,true),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -