1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2001-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20%% 21 22-module(testMegaco). 23 24-export([compile/3,main/2]). 25 26-include_lib("common_test/include/ct.hrl"). 27 28compile(Config, Erule, Options) -> 29 asn1_test_lib:compile("MEDIA-GATEWAY-CONTROL.asn", Config, [Erule|Options]), 30 asn1_test_lib:compile("OLD-MEDIA-GATEWAY-CONTROL.asn", Config, [Erule|Options]), 31 {ok,'OLD-MEDIA-GATEWAY-CONTROL','MEDIA-GATEWAY-CONTROL'}. 32 33main(no_module,_) -> ok; 34main('OLD-MEDIA-GATEWAY-CONTROL',Config) -> 35 CaseDir = proplists:get_value(case_dir, Config), 36 {ok,Msg} = asn1ct:value('OLD-MEDIA-GATEWAY-CONTROL','MegacoMessage', 37 [{i, CaseDir}]), 38 asn1_test_lib:roundtrip('OLD-MEDIA-GATEWAY-CONTROL', 'MegacoMessage', Msg), 39 ok; 40main('MEDIA-GATEWAY-CONTROL'=Mod, Config) -> 41 DataDir = proplists:get_value(data_dir, Config), 42 Files = filelib:wildcard(filename:join([DataDir,megacomessages,"*.val"])), 43 lists:foreach(fun(File) -> 44 {ok,Bin} = file:read_file(File), 45 V = binary_to_term(Bin), 46 T = element(1, V), 47 asn1_test_lib:roundtrip(Mod, T, V) 48 end, Files). 49