4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
25
-include("test_server.hrl").
27
-record('Set1',{bool1, int1, set1 = asn1_DEFAULT}).
28
-record('Set2',{set2 = asn1_DEFAULT, bool2, int2}).
29
-record('Set3',{bool3, set3 = asn1_DEFAULT, int3}).
30
-record('Set4',{set41 = asn1_DEFAULT, set42 = asn1_DEFAULT, set43 = asn1_DEFAULT}).
31
-record('SetIn',{boolIn, intIn}).
32
%-record('SetCho',{bool1, int1, set1 = asn1_DEFAULT}).
33
%-record('SetChoInline',{bool1, int1, set1 = asn1_DEFAULT}).
34
%-record('SetChoOfInline_SETOF',{bool1, int1, set1 = asn1_DEFAULT}).
35
-record('SetEmp',{set1}).
40
compile(Config,Rules,Options) ->
42
?line DataDir = ?config(data_dir,Config),
43
?line OutDir = ?config(priv_dir,Config),
44
?line true = code:add_patha(?config(priv_dir,Config)),
45
?line ok = asn1ct:compile(DataDir ++ "SetOf",[Rules,{outdir,OutDir}]++Options).
52
asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
54
?line {ok,{'Set1',true,17,[]}} =
55
asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes11)),
59
asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
61
set1 = [#'SetIn'{boolIn = true,
63
?line {ok,{'Set1',true,17,[{'SetIn',true,25}]}} =
64
asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes12)),
69
asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
71
set1 = [#'SetIn'{boolIn = true,
73
#'SetIn'{boolIn = false,
75
#'SetIn'{boolIn = false,
77
?line {ok,{'Set1',true,17,[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}]}} =
78
asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes13)),
86
asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
89
?line {ok,{'Set2',[],true,17}} =
90
asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes21)),
94
asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
96
set2 = [#'SetIn'{boolIn = true,
98
?line {ok,{'Set2',[{'SetIn',true,25}],true,17}} =
99
asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes22)),
103
asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
105
set2 = [#'SetIn'{boolIn = true,
107
#'SetIn'{boolIn = false,
109
#'SetIn'{boolIn = false,
111
?line {ok,{'Set2',[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],true,17}} =
112
asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes23)),
120
asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
122
?line {ok,{'Set3',true,[],17}} =
123
asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes31)),
127
asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
129
set3 = [#'SetIn'{boolIn = true,
131
?line {ok,{'Set3',true,[{'SetIn',true,25}],17}} =
132
asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes32)),
136
asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
138
set3 = [#'SetIn'{boolIn = true,
140
#'SetIn'{boolIn = false,
142
#'SetIn'{boolIn = false,
144
?line {ok,{'Set3',true,[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],17}} =
145
asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes33)),
153
?line {ok,Bytes41} = asn1_wrapper:encode('SetOf','Set4',#'Set4'{}),
154
?line {ok,{'Set4',[],[],[]}} = asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes41)),
158
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set41 = [#'SetIn'{boolIn = true,
160
?line {ok,{'Set4',[{'SetIn',true,25}],[],[]}} =
161
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes42)),
165
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set41 = [#'SetIn'{boolIn = true,
167
#'SetIn'{boolIn = false,
169
#'SetIn'{boolIn = false,
171
?line {ok,{'Set4',[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],[],[]}} =
172
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes43)),
176
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set42 = [#'SetIn'{boolIn = true,
178
?line {ok,{'Set4',[],[{'SetIn',true,25}],[]}} =
179
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes44)),
183
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set42 = [#'SetIn'{boolIn = true,
185
#'SetIn'{boolIn = false,
187
#'SetIn'{boolIn = false,
189
?line {ok,{'Set4',[],[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],[]}} =
190
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes45)),
194
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set43 = [#'SetIn'{boolIn = true,
196
?line {ok,{'Set4',[],[],[{'SetIn',true,25}]}} =
197
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes46)),
201
asn1_wrapper:encode('SetOf','Set4',#'Set4'{set43 = [#'SetIn'{boolIn = true,
203
#'SetIn'{boolIn = false,
205
#'SetIn'{boolIn = false,
207
?line {ok,{'Set4',[],[],[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}]}} =
208
asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes47)),
213
?line {ok,Bytes51} = asn1_wrapper:encode('SetOf','SetOs',["First","Second","Third"]),
214
?line {ok,["First","Second","Third"]} =
215
asn1_wrapper:decode('SetOf','SetOs',lists:flatten(Bytes51)),
217
?line {ok,Bytes52} = asn1_wrapper:encode('SetOf','SetOsImp',["First","Second","Third"]),
218
?line {ok,["First","Second","Third"]} =
219
asn1_wrapper:decode('SetOf','SetOsImp',lists:flatten(Bytes52)),
221
?line {ok,Bytes53} = asn1_wrapper:encode('SetOf','SetOsExp',["First","Second","Third"]),
222
?line {ok,["First","Second","Third"]} =
223
asn1_wrapper:decode('SetOf','SetOsExp',lists:flatten(Bytes53)),
231
?line {ok,Bytes71} = asn1_wrapper:encode('SetOf','SetEmp',#'SetEmp'{set1 = [#'Empty'{}]}),
232
?line {ok,{'SetEmp',[{'Empty'}]}} = asn1_wrapper:decode('SetOf','SetEmp',lists:flatten(Bytes71)),