📄 megaco_codec_prev3c_test.erl
字号:
%% ``The contents of this file are subject to the Erlang Public License,%% Version 1.1, (the "License"); you may not use this file except in%% compliance with the License. You should have received a copy of the%% Erlang Public License along with this software. If not, it can be%% retrieved via the world wide web at http://www.erlang.org/.%%%% Software distributed under the License is distributed on an "AS IS"%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See%% the License for the specific language governing rights and limitations%% under the License.%%%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings%% AB. All Rights Reserved.''%%%% $Id$%%%%----------------------------------------------------------------------%% Purpose: Test encoding/decoding (codec) module of Megaco/H.248%%-----------------------------------------------------------------------module(megaco_codec_prev3c_test).%% -----include_lib("megaco/include/megaco.hrl").-include_lib("megaco/include/megaco_message_prev3c.hrl").-include("megaco_test_lib.hrl").%% -----export([msgs/0]).-export([rfc3525_msgs_display/0, rfc3525_msgs_test/0]).-export([t/0, t/1]).-export([all/1, text/1, pretty/1, pretty_test_msgs/1, compact/1, compact_test_msgs/1, flex_pretty/1, flex_pretty_init/1, flex_pretty_finish/1, flex_pretty_test_msgs/1, flex_compact/1, flex_compact_init/1, flex_compact_finish/1, flex_compact_test_msgs/1, flex_compact_dm_timers1/1, flex_compact_dm_timers2/1, flex_compact_dm_timers3/1, flex_compact_dm_timers4/1, flex_compact_dm_timers5/1, flex_compact_dm_timers6/1, flex_compact_dm_timers7/1, flex_compact_dm_timers8/1, binary/1, bin/1, bin_test_msgs/1, ber/1, ber_test_msgs/1, ber_bin/1, ber_bin_test_msgs/1, per/1, per_test_msgs/1, per_bin/1, per_bin_test_msgs/1, erl_dist/1, erl_dist_m/1, erl_dist_m_test_msgs/1, tickets/0, tickets/1, compact_tickets/1, compact_otp4011_msg1/1, compact_otp4011_msg2/1, compact_otp4011_msg3/1, compact_otp4013_msg1/1, compact_otp4085_msg1/1, compact_otp4085_msg2/1, compact_otp4280_msg1/1, compact_otp4299_msg1/1, compact_otp4359_msg1/1, compact_otp4920_msg0/1, compact_otp4920_msg1/1, compact_otp4920_msg2/1, compact_otp4920_msg3/1, compact_otp4920_msg4/1, compact_otp4920_msg5/1, compact_otp4920_msg6/1, compact_otp4920_msg7/1, compact_otp4920_msg8/1, compact_otp4920_msg9/1, compact_otp4920_msg10/1, compact_otp4920_msg11/1, compact_otp4920_msg12/1, compact_otp4920_msg20/1, compact_otp4920_msg21/1, compact_otp4920_msg22/1, compact_otp4920_msg23/1, compact_otp4920_msg24/1, compact_otp4920_msg25/1, compact_otp5186_msg01/1, compact_otp5186_msg02/1, compact_otp5186_msg03/1, compact_otp5186_msg04/1, compact_otp5186_msg05/1, compact_otp5186_msg06/1, compact_otp5793_msg01/1, compact_otp5836_msg01/1, compact_otp5993_msg01/1, compact_otp5993_msg02/1, compact_otp5993_msg03/1, compact_otp6017_msg01/1, compact_otp6017_msg02/1, compact_otp6017_msg03/1, flex_compact_tickets/1, flex_compact_otp4299_msg1/1, pretty_tickets/1, pretty_otp4632_msg1/1, pretty_otp4632_msg2/1, pretty_otp4632_msg3/1, pretty_otp4632_msg4/1, pretty_otp4710_msg1/1, pretty_otp4710_msg2/1, pretty_otp4945_msg1/1, pretty_otp4945_msg2/1, pretty_otp4945_msg3/1, pretty_otp4945_msg4/1, pretty_otp4945_msg5/1, pretty_otp4945_msg6/1, pretty_otp4949_msg1/1, pretty_otp4949_msg2/1, pretty_otp4949_msg3/1, pretty_otp5042_msg1/1, pretty_otp5068_msg1/1, pretty_otp5085_msg1/1, pretty_otp5085_msg2/1, pretty_otp5085_msg3/1, pretty_otp5085_msg4/1, pretty_otp5085_msg5/1, pretty_otp5085_msg6/1, pretty_otp5085_msg7/1, pretty_otp5085_msg8/1, pretty_otp5600_msg1/1, pretty_otp5600_msg2/1, pretty_otp5601_msg1/1, pretty_otp5793_msg01/1, pretty_otp5803_msg01/1, pretty_otp5803_msg02/1, pretty_otp5805_msg01/1, pretty_otp5836_msg01/1, pretty_otp5882_msg01/1, pretty_otp6490_msg01/1, pretty_otp6490_msg02/1, pretty_otp6490_msg03/1, pretty_otp6490_msg04/1, pretty_otp6490_msg05/1, pretty_otp6490_msg06/1, flex_pretty_tickets/1, flex_pretty_otp5042_msg1/1, flex_pretty_otp5085_msg1/1, flex_pretty_otp5085_msg2/1, flex_pretty_otp5085_msg3/1, flex_pretty_otp5085_msg4/1, flex_pretty_otp5085_msg5/1, flex_pretty_otp5085_msg6/1, flex_pretty_otp5085_msg7/1, flex_pretty_otp5085_msg8/1, flex_pretty_otp5600_msg1/1, flex_pretty_otp5600_msg2/1, flex_pretty_otp5601_msg1/1, flex_pretty_otp5793_msg01/1, flex_pretty_otp5803_msg01/1, flex_pretty_otp5803_msg02/1, flex_pretty_otp5805_msg01/1, flex_pretty_otp5836_msg01/1, init_per_testcase/2, fin_per_testcase/2]). -export([flex_scanner_handler/1]).-export([display_text_messages/0, generate_text_messages/0]).%% -----define(V3, prev3c).-define(EC_V3, {version3,?V3}).-define(EC, [?EC_V3]).-define(VERSION, 3).-define(VERSION_STR, "3").-define(MSG_LIB, megaco_test_msg_prev3c_lib).-define(DEFAULT_PORT, 55555).-define(MG1_MID_NO_PORT, {ip4Address, #'IP4Address'{address = [124, 124, 124, 222]}}).-define(MG1_MID, {ip4Address, #'IP4Address'{address = [124, 124, 124, 222], portNumber = ?DEFAULT_PORT}}).-define(MG2_MID, {ip4Address, #'IP4Address'{address = [125, 125, 125, 111], portNumber = ?DEFAULT_PORT}}).-define(MGC_MID, {ip4Address, #'IP4Address'{address = [123, 123, 123, 4], portNumber = ?DEFAULT_PORT}}).-define(A4444, ["11111111", "00000000", "00000000"]).-define(A4445, ["11111111", "00000000", "11111111"]).-define(A5555, ["11111111", "11111111", "00000000"]).-define(A5556, ["11111111", "11111111", "11111111"]).%% ----display_text_messages() -> Msgs = msgs1a(text) ++ msgs5(text) ++ msgs6(text) ++ msgs7(text), megaco_codec_test_lib:display_text_messages(?VERSION, ?EC, Msgs).generate_text_messages() -> Msgs = msgs1a(text) ++ msgs5(text) ++ msgs6(text) ++ msgs7(text), megaco_codec_test_lib:generate_text_messages(?V3, ?VERSION, ?EC, Msgs).%% ----expand(RootCase) -> expand([RootCase], []).expand([], Acc) -> lists:flatten(lists:reverse(Acc));expand([Case|Cases], Acc) -> case (catch apply(?MODULE,Case,[suite])) of [] -> expand(Cases, [Case|Acc]); C when list(C) -> expand(Cases, [expand(C, [])|Acc]); _ -> expand(Cases, [Case|Acc]) end. %% ----tickets() -> Flag = process_flag(trap_exit, true), Cases = expand(tickets), Fun = fun(Case) -> C = init_per_testcase(Case, [{tc_timeout, timer:minutes(10)}]), io:format("Eval ~w~n", [Case]), Result = case (catch apply(?MODULE, Case, [C])) of {'EXIT', Reason} -> io:format("~n~p exited:~n ~p~n", [Case, Reason]), {error, {Case, Reason}}; Res -> Res end, fin_per_testcase(Case, C), Result end, process_flag(trap_exit, Flag), lists:map(Fun, Cases).%% ----t() -> megaco_test_lib:t(?MODULE).t(Case) -> megaco_test_lib:t({?MODULE, Case}).init_per_testcase(Case, Config) -> %% CaseString = io_lib:format("~p", [Case]), C = case lists:suffix("time_test", atom_to_list(Case)) of true -> [{tc_timeout, timer:minutes(10)}|Config]; false -> put(verbosity,trc), Config end, megaco_test_lib:init_per_testcase(Case, C).fin_per_testcase(Case, Config) -> erase(verbosity), megaco_test_lib:fin_per_testcase(Case, Config).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Top test caseall(suite) -> [ text, binary, erl_dist, tickets ].text(suite) -> [ pretty, flex_pretty, compact, flex_compact ].binary(suite) -> [ bin, ber, ber_bin, per, per_bin ].erl_dist(suite) -> [ erl_dist_m ].pretty(suite) -> [ pretty_test_msgs ].compact(suite) -> [ compact_test_msgs ].flex_pretty(suite) -> {req, [], {conf, flex_pretty_init, flex_pretty_cases(), flex_pretty_finish}}.flex_pretty_cases() -> [ flex_pretty_test_msgs ].flex_compact(suite) -> {req, [], {conf, flex_compact_init, flex_compact_cases(), flex_compact_finish}}.flex_compact_cases() -> [ flex_compact_test_msgs, flex_compact_dm_timers1, flex_compact_dm_timers2, flex_compact_dm_timers3, flex_compact_dm_timers4, flex_compact_dm_timers5, flex_compact_dm_timers6, flex_compact_dm_timers7, flex_compact_dm_timers8 ].bin(suite) -> [ bin_test_msgs ].ber(suite) -> [ ber_test_msgs ].ber_bin(suite) -> [ ber_bin_test_msgs ].per(suite) -> [ per_test_msgs ].%% Support for per_bin was added to ASN.1 as of version%% 1.3.2 (R8). And later merged into 1.3.1.3 (R7). These%% releases are identical (as far as I know).%% per_bin(suite) -> [ per_bin_test_msgs ].erl_dist_m(suite) -> [ erl_dist_m_test_msgs ].tickets(suite) -> [ compact_tickets, flex_compact_tickets, pretty_tickets, flex_pretty_tickets ].compact_tickets(suite) -> [ compact_otp4011_msg1, compact_otp4011_msg2, compact_otp4011_msg3, compact_otp4013_msg1, compact_otp4085_msg1, compact_otp4085_msg2, compact_otp4280_msg1, compact_otp4299_msg1, compact_otp4359_msg1, compact_otp4920_msg0, compact_otp4920_msg1, compact_otp4920_msg2, compact_otp4920_msg3, compact_otp4920_msg4, compact_otp4920_msg5, compact_otp4920_msg6, compact_otp4920_msg7, compact_otp4920_msg8, compact_otp4920_msg9, compact_otp4920_msg10, compact_otp4920_msg11, compact_otp4920_msg12, compact_otp4920_msg20, compact_otp4920_msg21, compact_otp4920_msg22, compact_otp4920_msg23, compact_otp4920_msg24, compact_otp4920_msg25, compact_otp5186_msg01, compact_otp5186_msg02, compact_otp5186_msg03, compact_otp5186_msg04, compact_otp5186_msg05, compact_otp5186_msg06, compact_otp5793_msg01, compact_otp5836_msg01, compact_otp5993_msg01, compact_otp5993_msg02, compact_otp5993_msg03, compact_otp6017_msg01, compact_otp6017_msg02, compact_otp6017_msg03 ].flex_compact_tickets(suite) -> {req, [], {conf, flex_compact_init, flex_compact_tickets_cases(), flex_compact_finish}}. flex_compact_tickets_cases() ->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -