megaco_sdp_test.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 974 行 · 第 1/3 页
ERL
974 行
%% ``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 application config%%-----------------------------------------------------------------------module(megaco_sdp_test).-export([all/1, decode_encode/1, %% tickets/1, init_per_testcase/2, fin_per_testcase/2, t/0, t/1]).-include("megaco_test_lib.hrl").-include_lib("megaco/include/megaco.hrl").-include_lib("megaco/include/megaco_message_v1.hrl").-include_lib("megaco/include/megaco_sdp.hrl").t() -> megaco_test_lib:t(?MODULE).t(Case) -> megaco_test_lib:t({?MODULE, Case}).%% Test server callbacksinit_per_testcase(Case, Config) -> megaco_test_lib:init_per_testcase(Case, Config).fin_per_testcase(Case, Config) -> megaco_test_lib:fin_per_testcase(Case, Config).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Top test case%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%all(suite) -> [ decode_encode%% ,%% tickets ].%% tickets(suite) ->%% [].%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%decode_encode(suite) -> [];decode_encode(Config) when list(Config) -> io:format("decode_encode -> entry with" "~n Config: ~p" "~n", [Config]), %%------------------------------------- %% Test data %%------------------------------------- %% -- (PP) (ok) -- io:format("setup for protocol version 01 (ok)~n", []), PP_V01_V = 0, PP_V01 = cre_PropertyParm_v(PP_V01_V), SDP_V01 = cre_sdp_v(PP_V01_V), PP_V01_Exp = {ok, SDP_V01}, SDP_V01_Exp = {ok, PP_V01}, %% -- (PP) (ok) -- io:format("setup for protocol version 02 (ok)~n", []), PP_V02_V = 100, PP_V02 = cre_PropertyParm_v(PP_V02_V), SDP_V02 = cre_sdp_v(PP_V02_V), PP_V02_Exp = {ok, SDP_V02}, SDP_V02_Exp = {ok, PP_V02}, %% -- (PP) (error) -- io:format("setup for protocol version 03 (error)~n", []), PP_V03_V = "sune", PP_V03 = cre_PropertyParm_v(PP_V03_V), SDP_V03 = cre_sdp_v(PP_V03_V), PP_V03_Exp = {error, {invalid_protocol_version, PP_V03_V}}, SDP_V03_Exp = PP_V03_Exp, %% -- (PP) (ok) -- io:format("setup for connection info 01 (ok)~n", []), PP_C01_CA = "123.123.123.120", PP_C01 = cre_PropertyParm_c(ip4, PP_C01_CA), SDP_C01 = cre_sdp_c(ip4, PP_C01_CA), PP_C01_Exp = {ok, SDP_C01}, SDP_C01_Exp = {ok, PP_C01}, %% -- (PP) (ok) -- io:format("setup for connection info 02 (ok)~n", []), PP_C02_TTL = 121, PP_C02_Base = "123.123.123.121", PP_C02 = cre_PropertyParm_c(ip4, PP_C02_Base, PP_C02_TTL), SDP_C02_CA = #megaco_sdp_c_conn_addr{base = PP_C02_Base, ttl = PP_C02_TTL}, SDP_C02 = cre_sdp_c(ip4, SDP_C02_CA), PP_C02_Exp = {ok, SDP_C02}, SDP_C02_Exp = {ok, PP_C02}, %% -- (PP) (ok) -- io:format("setup for connection info 03 (ok)~n", []), PP_C03_CA = "123.123.123.122", PP_C03 = cre_PropertyParm_c(ip4, PP_C03_CA ++ "/"), SDP_C03 = cre_sdp_c(ip4, PP_C03_CA), PP_C03_Exp = {ok, SDP_C03}, SDP_C03_Exp = {ok, cre_PropertyParm_c(ip4, PP_C03_CA)}, %% -- (PP) (error) -- io:format("setup for connection info 04 (error)~n", []), PP_C04_Base = "123.123.123.123", PP_C04_TTL = "sune", PP_C04_CA = PP_C04_Base ++ "/" ++ PP_C04_TTL, PP_C04 = cre_PropertyParm_c(ip4, PP_C04_CA), PP_C04_Exp = {error, {invalid_connection_data_conn_addr_ttl, "sune"}}, %% -- (PP) (ok) -- io:format("setup for connection info 05 (ok)~n", []), PP_C05_TTL = 124, PP_C05_NOF = 224, PP_C05_Base = "123.123.123.124", PP_C05 = cre_PropertyParm_c(ip4, PP_C05_Base, PP_C05_TTL, PP_C05_NOF), SDP_C05_CA = #megaco_sdp_c_conn_addr{base = PP_C05_Base, ttl = PP_C05_TTL, num_of = PP_C05_NOF}, SDP_C05 = cre_sdp_c(ip4, SDP_C05_CA), PP_C05_Exp = {ok, SDP_C05}, SDP_C05_Exp = {ok, PP_C05}, %% -- (PP) (ok) -- io:format("setup for connection info 06 (ok)~n", []), PP_C06_TTL = 125, PP_C06_Base = "123.123.123.125", PP_C06_CA = PP_C06_Base ++ "/" ++ integer_to_list(PP_C06_TTL) ++ "/", PP_C06 = cre_PropertyParm_c(ip4, PP_C06_CA), SDP_C06_CA = #megaco_sdp_c_conn_addr{base = PP_C06_Base, ttl = PP_C06_TTL}, SDP_C06 = cre_sdp_c(ip4, SDP_C06_CA), PP_C06_Exp = {ok, SDP_C06}, SDP_C06_Exp = {ok, cre_PropertyParm_c(ip4, PP_C06_Base ++ "/" ++ integer_to_list(PP_C06_TTL))}, %% -- (PP) (error) -- io:format("setup for connection info 07 (ok)~n", []), PP_C07_NOF = "sune", PP_C07_TTL = 125, PP_C07_Base = "123.123.123.126", PP_C07_CA = PP_C07_Base ++ "/" ++ integer_to_list(PP_C07_TTL) ++ "/" ++ PP_C07_NOF, PP_C07 = cre_PropertyParm_c(ip4, PP_C07_CA), SDP_C07_CA = #megaco_sdp_c_conn_addr{base = PP_C07_Base, ttl = PP_C07_TTL, num_of = PP_C07_NOF}, SDP_C07 = cre_sdp_c(ip4, SDP_C07_CA), PP_C07_Exp = {error, {invalid_connection_data_conn_addr_num_of, PP_C07_NOF}}, SDP_C07_Exp = {error, {invalid_connection_data_conn_addr_num_of, PP_C07_NOF}}, %% -- (PP) (ok) -- io:format("setup for connection info 08 (ok)~n", []), PP_C08_CA = "FF1E:03AD::7F2E:172A:1E24", PP_C08 = cre_PropertyParm_c(ip6, PP_C08_CA), SDP_C08 = cre_sdp_c(ip6, PP_C08_CA), PP_C08_Exp = {ok, SDP_C08}, SDP_C08_Exp = {ok, PP_C08}, %% -- (PP) (ok) -- io:format("setup for media announcement 01 (ok)~n", []), PP_M01_Media = audio, PP_M01_Port = 2000, PP_M01_Transport = "RTP/AVP", PP_M01_FMT_LST = ["0"], PP_M01 = cre_PropertyParm_m(PP_M01_Media, PP_M01_Port, PP_M01_Transport, PP_M01_FMT_LST), SDP_M01 = cre_sdp_m(PP_M01_Media, PP_M01_Port, PP_M01_Transport, PP_M01_FMT_LST), PP_M01_Exp = {ok, SDP_M01}, SDP_M01_Exp = {ok, PP_M01}, %% -- (PP) (ok) -- io:format("setup for media announcement 02 (ok)~n", []), PP_M02_Media = audio, PP_M02_Port = 2000, PP_M02_NOP = 2, PP_M02_Transport = "RTP/AVP", PP_M02_FMT_LST = ["0"], PP_M02 = cre_PropertyParm_m(PP_M02_Media, PP_M02_Port, PP_M02_NOP, PP_M02_Transport, PP_M02_FMT_LST), SDP_M02 = cre_sdp_m(PP_M02_Media, PP_M02_Port, PP_M02_NOP, PP_M02_Transport, PP_M02_FMT_LST), PP_M02_Exp = {ok, SDP_M02}, SDP_M02_Exp = {ok, PP_M02}, %% -- (PP) (ok) -- io:format("setup for origin 01 (ok)~n", []), PP_O01_Name = "kalle", PP_O01_SID = 1414, PP_O01_V = 2, PP_O01_AT = ip4, PP_O01_A = "126.12.64.4", PP_O01 = cre_PropertyParm_o(PP_O01_Name, PP_O01_SID, PP_O01_V, PP_O01_AT, PP_O01_A), SDP_O01 = cre_sdp_o(PP_O01_Name, PP_O01_SID, PP_O01_V, PP_O01_AT, PP_O01_A), PP_O01_Exp = {ok, SDP_O01}, SDP_O01_Exp = {ok, PP_O01}, %% -- (PP) (ok) -- io:format("setup for origin 02 (ok)~n", []), PP_O02_Name = "bobbe", PP_O02_SID = 1515, PP_O02_V = 3, PP_O02_NT = in, PP_O02_AT = ip6, PP_O02_A = "2201:056D::112E:144A:1E24", PP_O02 = cre_PropertyParm_o(PP_O02_Name, PP_O02_SID, PP_O02_V, PP_O02_NT, PP_O02_AT, PP_O02_A), SDP_O02 = cre_sdp_o(PP_O02_Name, PP_O02_SID, PP_O02_V, PP_O02_NT, PP_O02_AT, PP_O02_A), PP_O02_Exp = {ok, SDP_O02}, SDP_O02_Exp = {ok, PP_O02}, %% -- (PP) (ok) -- PP_A01_PL = 2, PP_A01_EN = "G726-32", PP_A01_CR = 8000, PP_A01 = cre_PropertyParm_rtpmap(PP_A01_PL, PP_A01_EN, PP_A01_CR), SDP_A01 = cre_sdp_a_rtpmap(PP_A01_PL, PP_A01_EN, PP_A01_CR), PP_A01_Exp = {ok, SDP_A01}, SDP_A01_Exp = {ok, PP_A01}, %% -- (PP) (ok) -- PP_A02_PL = 2, PP_A02_EN = "xxx", PP_A02_CR = 42, PP_A02_EP = ["1","2","3"], PP_A02 = cre_PropertyParm_rtpmap(PP_A02_PL, PP_A02_EN, PP_A02_CR, PP_A02_EP), SDP_A02 = cre_sdp_a_rtpmap(PP_A02_PL, PP_A02_EN, PP_A02_CR, PP_A02_EP), PP_A02_Exp = {ok, SDP_A02}, SDP_A02_Exp = {ok, PP_A02}, %% -- (PP) (ok) -- PP_A03_PT = 12, PP_A03 = cre_PropertyParm_ptime(PP_A03_PT), SDP_A03 = cre_sdp_a_ptime(PP_A03_PT), PP_A03_Exp = {ok, SDP_A03}, SDP_A03_Exp = {ok, PP_A03}, %% -- (PP) (error) -- PP_A04_PT = "sune", PP_A04 = cre_PropertyParm_ptime(PP_A04_PT), SDP_A04 = cre_sdp_a_ptime(PP_A04_PT), PP_A04_Exp = {error, {invalid_ptime_packet_time, PP_A04_PT}}, SDP_A04_Exp = {error, {invalid_ptime_packet_time, PP_A04_PT}}, %% -- (PP) (ok) -- PP_A05_QA = 10, PP_A05 = cre_PropertyParm_quality(PP_A05_QA), SDP_A05 = cre_sdp_a_quality(PP_A05_QA), PP_A05_Exp = {ok, SDP_A05}, SDP_A05_Exp = {ok, PP_A05}, %% -- (PP) (error) -- PP_A06_QA = "sune", PP_A06 = cre_PropertyParm_quality(PP_A06_QA), SDP_A06 = cre_sdp_a_quality(PP_A06_QA), PP_A06_Exp = {error, {invalid_quality_quality, PP_A06_QA}}, SDP_A06_Exp = {error, {invalid_quality_quality, PP_A06_QA}}, %% -- (PP) (ok) -- PP_A07_A = "recvonly", PP_A07 = cre_PropertyParm_a(PP_A07_A), SDP_A07 = cre_sdp_a(PP_A07_A), PP_A07_Exp = {ok, SDP_A07}, SDP_A07_Exp = {ok, PP_A07}, %% -- (PP) (ok) -- PP_A08_A = "orient", PP_A08_V = "portrait", PP_A08 = cre_PropertyParm_a(PP_A08_A, PP_A08_V), SDP_A08 = cre_sdp_a(PP_A08_A, PP_A08_V), PP_A08_Exp = {ok, SDP_A08}, SDP_A08_Exp = {ok, PP_A08},
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?