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-module(testParamBasic). 22 23-export([main/1]). 24 25-include_lib("common_test/include/ct.hrl"). 26 27-record('T11',{number, string=asn1_DEFAULT}). 28-record('T12',{number, string=asn1_DEFAULT}). 29-record('T21',{number, string}). 30-record('T22',{number, string}). 31 32main(Rules) -> 33 roundtrip('T11', #'T11'{number=11,string="hello"}), 34 roundtrip('T12', #'T12'{number=11,string = <<21:5>>}), 35 roundtrip('T21', #'T21'{number=11,string="hello"}), 36 roundtrip('T22', #'T22'{number=11,string = <<21:5>>}), 37 case Rules of 38 der -> 39 <<48,3,128,1,11>> = 40 roundtrip_enc('T11', #'T11'{number=11,string="hej"}), 41 <<48,3,128,1,11>> = 42 roundtrip_enc('T12', 43 #'T12'{number=11,string=[1,0,1,0]}, 44 #'T12'{number=11,string = <<10:4>>}); 45 _ -> ok 46 end, 47 roundtrip('AnAlgorithm', {'AnAlgorithm',1,42}), 48 roundtrip('AnAlgorithm', {'AnAlgorithm',2,true}), 49 roundtrip('AnAlgorithm', {'AnAlgorithm',2,false}), 50 {'AnAlgorithm',1,42} = 'ParamBasic':'alg-seq-1'(), 51 {'AnAlgorithm',2,true} = 'ParamBasic':'alg-seq-2'(), 52 53 roundtrip('Seq', {'Seq', 54 {'Seq_c1',{2,1,1},42}, 55 {'Seq_c2',{2,1,1,1},asn1_NOVALUE}}), 56 57 {_,{2,9,9,9,7},'NULL'} = 'ParamBasic':'algid-hmacWithSHA1'(), 58 ok. 59 60roundtrip(Type, Value) -> 61 asn1_test_lib:roundtrip('ParamBasic', Type, Value). 62 63roundtrip_enc(Type, Value) -> 64 asn1_test_lib:roundtrip_enc('ParamBasic', Type, Value). 65 66roundtrip_enc(Type, Value, Expected) -> 67 asn1_test_lib:roundtrip_enc('ParamBasic', Type, Value, Expected). 68