📄 megaco_codec_prev3a_test.erl
字号:
compact_otp6017_msg01, compact_otp6017_msg02, compact_otp6017_msg03 ].pretty_tickets(suite) -> [ pretty_otp4632_msg1, pretty_otp4632_msg2, pretty_otp4632_msg3, pretty_otp4632_msg4, pretty_otp4710_msg1, pretty_otp4710_msg2, pretty_otp4945_msg1, pretty_otp4945_msg2, pretty_otp4945_msg3, pretty_otp4945_msg4, pretty_otp4945_msg5, pretty_otp4945_msg6, pretty_otp4949_msg1, pretty_otp4949_msg2, pretty_otp4949_msg3, pretty_otp5042_msg1, pretty_otp5068_msg1, pretty_otp5085_msg1, pretty_otp5085_msg2, pretty_otp5085_msg3, pretty_otp5085_msg4, pretty_otp5085_msg5, pretty_otp5085_msg6, pretty_otp5085_msg7, pretty_otp5085_msg8, pretty_otp5600_msg1, pretty_otp5600_msg2, pretty_otp5601_msg1, pretty_otp5793_msg01, pretty_otp5882_msg01, pretty_otp6490_msg01, pretty_otp6490_msg02, pretty_otp6490_msg03, pretty_otp6490_msg04, pretty_otp6490_msg05, pretty_otp6490_msg06 ].flex_pretty_tickets(suite) -> {req, [], {conf, flex_pretty_init, flex_pretty_tickets_cases(), flex_pretty_finish}}. flex_pretty_tickets_cases() -> [ flex_pretty_otp5042_msg1, flex_pretty_otp5085_msg1, flex_pretty_otp5085_msg2, flex_pretty_otp5085_msg3, flex_pretty_otp5085_msg4, flex_pretty_otp5085_msg5, flex_pretty_otp5085_msg6, flex_pretty_otp5085_msg7, flex_pretty_otp5085_msg8, flex_pretty_otp5600_msg1, flex_pretty_otp5600_msg2, flex_pretty_otp5601_msg1, flex_pretty_otp5793_msg01 ]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%pretty_test_msgs(suite) -> [];pretty_test_msgs(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), Msgs = msgs1(text) ++ msgs2(text) ++ msgs3(text) ++ msgs4(text) ++ msgs5(text) ++ msgs6(text), %% Msgs = msgs5(text), %% Msgs = msgs6(text), DynamicDecode = false, test_msgs(megaco_pretty_text_encoder, DynamicDecode, ?EC, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%flex_pretty_init(Config) when list(Config) -> Flag = process_flag(trap_exit, true), Res = (catch start_flex_scanner()), process_flag(trap_exit, Flag), case Res of {error, Reason} -> ?LOG("flex_pretty_init -> error: " "~n Reason: ~p~n", [Reason]), skip(Reason); {Pid, Conf} when pid(Pid) -> [{flex_scanner, Pid, Conf}|Config] end;flex_pretty_init(Config) -> exit({invalid_config, Config}). flex_pretty_finish(Config) when list(Config) -> case lists:keysearch(flex_scanner, 1, Config) of {value, {flex_scanner, Pid, _Conf}} -> stop_flex_scanner(Pid), lists:keydelete(flex_scanner, 1, Config); false -> Config end. flex_pretty_test_msgs(suite) -> [];flex_pretty_test_msgs(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config),%% Msgs = msgs5(text), Msgs = msgs1(text) ++ msgs2(text) ++ msgs3(text) ++ msgs4(text) ++ msgs5(text) ++ msgs6(text), Conf = flex_scanner_conf(Config), DynamicDecode = false, test_msgs(megaco_pretty_text_encoder, DynamicDecode, [?EC_V3,Conf], Msgs).flex_pretty_otp5042_msg1(suite) -> [];flex_pretty_otp5042_msg1(Config) when list(Config) -> d("flex_pretty_otp5042_msg1 -> entry", []), ?ACQUIRE_NODES(1, Config), Msg0 = pretty_otp5042_msg1(), Bin0 = list_to_binary(Msg0), case decode_message(megaco_pretty_text_encoder, false, ?EC, Bin0) of {error, [{reason, Reason}|_]} -> case Reason of {_, _Mod, {bad_timeStamp, TimeStamp}} -> exit({bad_timeStamp, TimeStamp}); _ -> io:format("flex_pretty_otp5042_msg1 -> " "~n Reason: ~w" "~n", [Reason]), exit({unexpected_decode_result, Reason}) end; {ok, M} -> t("flex_pretty_otp5042_msg1 -> successfull decode:" "~n~p", [M]), ok end.flex_pretty_otp5085_msg1(suite) -> [];flex_pretty_otp5085_msg1(Config) when list(Config) -> d("flex_pretty_otp5085_msg1 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg1(), [Conf]).flex_pretty_otp5085_msg2(suite) -> [];flex_pretty_otp5085_msg2(Config) when list(Config) -> d("flex_pretty_otp5085_msg2 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(error, pretty_otp5085_msg2(), [Conf]).flex_pretty_otp5085_msg3(suite) -> [];flex_pretty_otp5085_msg3(Config) when list(Config) -> d("flex_pretty_otp5085_msg3 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg3(), [Conf]).flex_pretty_otp5085_msg4(suite) -> [];flex_pretty_otp5085_msg4(Config) when list(Config) -> d("flex_pretty_otp5085_msg4 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg4(), [Conf]).flex_pretty_otp5085_msg5(suite) -> [];flex_pretty_otp5085_msg5(Config) when list(Config) -> d("flex_pretty_otp5085_msg5 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg5(), [Conf]).flex_pretty_otp5085_msg6(suite) -> [];flex_pretty_otp5085_msg6(Config) when list(Config) -> d("flex_pretty_otp5085_msg6 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg6(), [Conf]).flex_pretty_otp5085_msg7(suite) -> [];flex_pretty_otp5085_msg7(Config) when list(Config) -> d("flex_pretty_otp5085_msg7 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg7(), [Conf]).flex_pretty_otp5085_msg8(suite) -> [];flex_pretty_otp5085_msg8(Config) when list(Config) -> d("flex_pretty_otp5085_msg8 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5085(ok, pretty_otp5085_msg8(), [Conf]).flex_pretty_otp5600_msg1(suite) -> [];flex_pretty_otp5600_msg1(Config) when list(Config) -> d("flex_pretty_otp5600_msg1 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5600(ok, pretty_otp5600_msg1(), [Conf]). flex_pretty_otp5600_msg2(suite) -> [];flex_pretty_otp5600_msg2(Config) when list(Config) -> d("flex_pretty_otp5600_msg2 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5600(ok, pretty_otp5600_msg2(), [Conf]). flex_pretty_otp5601_msg1(suite) -> [];flex_pretty_otp5601_msg1(Config) when list(Config) -> d("flex_pretty_otp5601_msg1 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5601(ok, pretty_otp5601_msg1(), [Conf]).flex_pretty_otp5793_msg01(suite) -> [];flex_pretty_otp5793_msg01(Config) when list(Config) -> d("flex_pretty_otp5793_msg01 -> entry", []), ?ACQUIRE_NODES(1, Config), Conf = flex_scanner_conf(Config), pretty_otp5793(ok, pretty_otp5793_msg1(), [Conf]).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%compact_test_msgs(suite) -> [];compact_test_msgs(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), Msgs = msgs1(text) ++ msgs2(text) ++ msgs3(text) ++ msgs4(text) ++ msgs5(text) ++ msgs6(text), %% Msgs = msgs6(text), DynamicDecode = false, test_msgs(megaco_compact_text_encoder, DynamicDecode, ?EC, Msgs).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%flex_compact_init(Config) when list(Config) -> Flag = process_flag(trap_exit, true), Res = (catch start_flex_scanner()), process_flag(trap_exit, Flag), case Res of {error, Reason} -> ?LOG("flex_compact_init -> error: " "~n Reason: ~p~n", [Reason]), skip(Reason); {Pid, Conf} when pid(Pid) -> [{flex_scanner, Pid, Conf}|Config] end. flex_compact_finish(Config) when list(Config) -> case lists:keysearch(flex_scanner, 1, Config) of {value, {flex_scanner, Pid, _Conf}} -> stop_flex_scanner(Pid), lists:keydelete(flex_scanner, 1, Config); false -> Config end. flex_compact_test_msgs(suite) -> [];flex_compact_test_msgs(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), Msgs = msgs1(text) ++ msgs2(text) ++ msgs3(text) ++ msgs4(text) ++ msgs5(text) ++ msgs6(text), Conf = flex_scanner_conf(Config), DynamicDecode = true, test_msgs(megaco_compact_text_encoder, DynamicDecode, [?EC_V3,Conf], Msgs).flex_compact_dm_timers1(suite) -> [];flex_compact_dm_timers1(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("1", "2", "3"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers1 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({1,2,3}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers2(suite) -> [];flex_compact_dm_timers2(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("02", "03", "04"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers2 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({2,3,4}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers3(suite) -> [];flex_compact_dm_timers3(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("1", "02", "31"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers3 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({1,2,31}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers4(suite) -> [];flex_compact_dm_timers4(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("10", "21", "99"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers4 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({10,21,99}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers5(suite) -> [];flex_compact_dm_timers5(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("99", "23", "11"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers5 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({99,23,11}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers6(suite) -> [];flex_compact_dm_timers6(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("77", "09", "1"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers6 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({77,9,1}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers7(suite) -> [];flex_compact_dm_timers7(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("77", "09", "1", "99"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers7 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({77,9,1,99}, M1); Else -> exit({decode_failed, M, Else}) end.flex_compact_dm_timers8(suite) -> [];flex_compact_dm_timers8(Config) when list(Config) -> ?ACQUIRE_NODES(1, Config), M = build_dm_timers_message("01", "09", "01", "02"), B = list_to_binary(M), Conf = flex_scanner_conf(Config), case decode_message(megaco_compact_text_encoder, false, [?EC_V3,Conf], B) of {ok, M1} when record(M1,'MegacoMessage') -> t("flex_compact_dm_timers8 -> " "~n M: ~s" "~n M1: ~p", [M, M1]), verify_dm_timers({1,9,1,2}, M1); Else -> exit({decode_failed, M, Else}) end.build_dm_timers_message(T, S, L) -> TMRs = lists:flatten(io_lib:format("T:~s,S:~s,L:~s", [T, S, L])), build_dm_timers_message(TMRs).build_dm_timers_message(T, S, L, Z) ->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -