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(testSeqOfCho).
22
23-export([main/1]).
24
25-include_lib("common_test/include/ct.hrl").
26
27-record('SeqChoDef',{bool1, int1, seq1 = asn1_DEFAULT}).
28-record('SeqChoOpt',{bool1, int1, seq1 = asn1_NOVALUE}).
29-record('SeqChoEmbDef',{bool1, int1, seq1 = asn1_DEFAULT}).
30-record('SeqChoEmbOpt',{bool1, int1, seq1 = asn1_NOVALUE}).
31-record('SeqOfChoEmbDef_SEQOF',{bool1, int1, seq1 = asn1_DEFAULT}).
32-record('SeqOfChoEmbOpt_SEQOF',{bool1, int1, seq1 = asn1_NOVALUE}).
33
34main(_Rules) ->
35    roundtrip('SeqChoDef',
36	      #'SeqChoDef'{bool1=true,int1=17,seq1=asn1_DEFAULT},
37	      #'SeqChoDef'{bool1=true,int1=17,seq1=[]}),
38    roundtrip('SeqChoDef',
39	      #'SeqChoDef'{bool1=true,int1=17,
40			   seq1=[{boolIn,true},{intIn,25}]}),
41    roundtrip('SeqChoOpt',
42	      #'SeqChoOpt'{bool1=true,int1=17,seq1=asn1_NOVALUE}),
43    roundtrip('SeqChoOpt',
44	      #'SeqChoOpt'{bool1=true,int1=17,
45			   seq1=[{boolIn,true},{intIn,25}]}),
46
47    roundtrip('SeqChoEmbDef',
48	      #'SeqChoEmbDef'{bool1=true,int1=17,seq1=asn1_DEFAULT},
49	      #'SeqChoEmbDef'{bool1=true,int1=17,seq1=[]}),
50    roundtrip('SeqChoEmbDef',
51	      #'SeqChoEmbDef'{bool1=true,int1=17,
52			      seq1=[{boolIn,true},{intIn,25}]}),
53    roundtrip('SeqChoEmbOpt',
54	      #'SeqChoEmbOpt'{bool1=true,int1=17,seq1=asn1_NOVALUE}),
55    roundtrip('SeqChoEmbOpt',
56	      #'SeqChoEmbOpt'{bool1=true,int1=17,
57			      seq1=[{boolIn,true},{intIn,25}]}),
58
59    roundtrip('SeqOfChoEmbDef',
60	      [#'SeqOfChoEmbDef_SEQOF'{bool1=true,int1=17,seq1=asn1_DEFAULT}],
61	      [#'SeqOfChoEmbDef_SEQOF'{bool1=true,int1=17,seq1=[]}]),
62    roundtrip('SeqOfChoEmbDef',
63	      [#'SeqOfChoEmbDef_SEQOF'{bool1=true,int1=17,
64				       seq1=[{boolIn,true},{intIn,25}]}]),
65    roundtrip('SeqOfChoEmbOpt',
66	      [#'SeqOfChoEmbOpt_SEQOF'{bool1=true,int1=17,seq1=asn1_NOVALUE}]),
67    roundtrip('SeqOfChoEmbOpt',
68	      [#'SeqOfChoEmbOpt_SEQOF'{bool1=true,int1=17,
69				       seq1=[{boolIn,true},{intIn,25}]}]),
70    ok.
71
72roundtrip(Type, Value) ->
73    roundtrip(Type, Value, Value).
74
75roundtrip(Type, Value, ExpectedValue) ->
76    asn1_test_lib:roundtrip('SeqOfCho', Type, Value, ExpectedValue).
77