1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2007-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(testDoubleEllipses).
22
23-export([main/1]).
24
25-include_lib("common_test/include/ct.hrl").
26
27-record('Seq',{a, c}).
28-record('SeqV1',{a, b}).
29-record('SeqV2',{a, b ,c}).
30-record('SeqAlt',{a,d,b,e,c,f,g}).
31-record('SeqAltV2',{a,d,b,e,h,i,c,f,g}).
32
33-record('Set',{a, c}).
34-record('SetV1',{a, b}).
35-record('SetV2',{a, b ,c}).
36-record('SetAlt',{a,d,b,e,c,f,g}).
37-record('SetAltV2',{a,d,b,e,h,i,c,f,g}).
38
39main(_Rules) ->
40    roundtrip('Seq', #'Seq'{a=10,c=true}),
41    roundtrip('SeqV1', #'SeqV1'{a=10,b=false}),
42    roundtrip('SeqV2', #'SeqV2'{a=10,b=false,c=true}),
43    roundtrip('SeqAlt',
44	      #'SeqAlt'{a=10,d=12,b = <<2#1010:4>>,
45			e=true,c=false,f=14,g=16}),
46    roundtrip('SeqAltV2',
47	      #'SeqAltV2'{a=10,d=12,
48			  b = <<2#1010:4>>,
49			  e=true,h="PS",i=13,c=false,f=14,g=16}),
50
51    roundtrip('Set', #'Set'{a=10,c=true}),
52    roundtrip('SetV1', #'SetV1'{a=10,b=false}),
53    roundtrip('SetV2', #'SetV2'{a=10,b=false,c=true}),
54    roundtrip('SetAlt',
55	      #'SetAlt'{a=10,d=12,
56			b = <<2#1010:4>>,
57			e=true,c=false,f=14,g=16}),
58    roundtrip('SetAltV2',
59	      #'SetAltV2'{a=10,d=12,
60			  b = <<2#1010:4>>,
61			  e=true,h="PS",i=13,c=false,f=14,g=16}),
62
63    roundtrip('SeqDoubleEmpty1',
64	      {'SeqDoubleEmpty1'}),
65    roundtrip('SeqDoubleEmpty2',
66	      {'SeqDoubleEmpty2',true,42}),
67    roundtrip('SeqDoubleEmpty2',
68	      {'SeqDoubleEmpty2',true,asn1_NOVALUE}),
69
70    ok.
71
72roundtrip(T, V) ->
73    asn1_test_lib:roundtrip('DoubleEllipses', T, V).
74