1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1997-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(testSetOfCho).
22
23-export([main/1]).
24
25-include_lib("common_test/include/ct.hrl").
26
27-record('SetChoDef',{bool1, int1, set1 = asn1_DEFAULT}).
28-record('SetChoOpt',{bool1, int1, set1 = asn1_NOVALUE}).
29-record('SetChoEmbDef',{bool1, int1, set1 = asn1_DEFAULT}).
30-record('SetChoEmbOpt',{bool1, int1, set1 = asn1_NOVALUE}).
31-record('SetOfChoEmbDef_SETOF',{bool1, int1, set1 = asn1_DEFAULT}).
32-record('SetOfChoEmbOpt_SETOF',{bool1, int1, set1 = asn1_NOVALUE}).
33
34main(_Rules) ->
35    roundtrip('SetChoDef',
36	      #'SetChoDef'{bool1=true,int1=17,set1=asn1_DEFAULT},
37	      #'SetChoDef'{bool1=true,int1=17,set1=[]}),
38    roundtrip('SetChoDef',
39	      #'SetChoDef'{bool1=true,int1=17,set1=[{boolIn,true},{intIn,25}]}),
40    roundtrip('SetChoOpt',
41	      #'SetChoOpt'{bool1=true,int1=17,set1=asn1_NOVALUE}),
42    roundtrip('SetChoOpt',
43	      #'SetChoOpt'{bool1=true,int1=17,set1=[{boolIn,true},{intIn,25}]}),
44
45    roundtrip('SetChoEmbDef',
46	      #'SetChoEmbDef'{bool1=true,int1=17,set1=asn1_DEFAULT},
47	      #'SetChoEmbDef'{bool1=true,int1=17,set1=[]}),
48    roundtrip('SetChoEmbDef',
49	      #'SetChoEmbDef'{bool1=true,int1=17,
50			      set1=[{boolIn,true},{intIn,25}]}),
51    roundtrip('SetChoEmbOpt',
52	      #'SetChoEmbOpt'{bool1=true,int1=17,set1=asn1_NOVALUE}),
53    roundtrip('SetChoEmbOpt',
54	      #'SetChoEmbOpt'{bool1=true,int1=17,
55			      set1=[{boolIn,true},{intIn,25}]}),
56
57    roundtrip('SetOfChoEmbDef',
58	      [#'SetOfChoEmbDef_SETOF'{bool1=true,int1=17,set1=asn1_DEFAULT}],
59	      [#'SetOfChoEmbDef_SETOF'{bool1=true,int1=17,set1=[]}]),
60    roundtrip('SetOfChoEmbDef',
61	      [#'SetOfChoEmbDef_SETOF'{bool1=true,int1=17,
62				       set1=[{boolIn,true},{intIn,25}]}]),
63
64    roundtrip('SetOfChoEmbOpt',
65	      [#'SetOfChoEmbOpt_SETOF'{bool1=true,int1=17,set1=asn1_NOVALUE}]),
66    roundtrip('SetOfChoEmbOpt',
67	      [#'SetOfChoEmbOpt_SETOF'{bool1=true,int1=17,
68				       set1=[{boolIn,true},{intIn,25}]}]),
69
70    ok.
71
72roundtrip(T, V) ->
73    roundtrip(T, V, V).
74
75roundtrip(Type, Value, ExpectedValue) ->
76    asn1_test_lib:roundtrip('SetOfCho', Type, Value, ExpectedValue).
77