4
%% Copyright Ericsson AB 1997-2010. 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_lib("test_server/include/test_server.hrl").
27
-record('Seq1',{bool1, int1, seq1 = asn1_DEFAULT}).
28
-record('Seq2',{seq2 = asn1_DEFAULT, bool2, int2}).
29
-record('Seq3',{bool3, seq3 = asn1_DEFAULT, int3}).
30
-record('Seq4',{seq41 = asn1_DEFAULT, seq42 = asn1_DEFAULT, seq43 = asn1_DEFAULT}).
31
-record('SeqIn',{boolIn, intIn}).
32
%-record('SeqCho',{bool1, int1, seq1 = asn1_DEFAULT}).
33
%-record('SeqChoInline',{bool1, int1, seq1 = asn1_DEFAULT}).
34
%-record('SeqChoOfInline_SEQOF',{bool1, int1, seq1 = asn1_DEFAULT}).
35
-record('SeqEmp',{seq1}).
39
compile(Config,Rules,Options) ->
41
?line DataDir = ?config(data_dir,Config),
42
?line OutDir = ?config(priv_dir,Config),
43
?line true = code:add_patha(?config(priv_dir,Config)),
44
?line ok = asn1ct:compile(DataDir ++ "SeqOf",[Rules,{outdir,OutDir}]++Options),
45
?line ok = asn1ct:compile(DataDir ++ "SeqOfEnum",[Rules,{outdir,OutDir}]++Options),
46
?line ok = asn1ct:compile(DataDir ++ "XSeqOf",[Rules,{outdir,OutDir}]++Options).
53
asn1_wrapper:encode('SeqOf','Seq1',#'Seq1'{bool1 = true,
55
?line {ok,{'Seq1',true,17,[]}} =
56
asn1_wrapper:decode('SeqOf','Seq1',lists:flatten(Bytes11)),
60
asn1_wrapper:encode('SeqOf','Seq1',#'Seq1'{bool1 = true,
62
seq1 = [#'SeqIn'{boolIn = true,
64
?line {ok,{'Seq1',true,17,[{'SeqIn',true,25}]}} =
65
asn1_wrapper:decode('SeqOf','Seq1',lists:flatten(Bytes12)),
70
asn1_wrapper:encode('SeqOf','Seq1',#'Seq1'{bool1 = true,
72
seq1 = [#'SeqIn'{boolIn = true,
74
#'SeqIn'{boolIn = false,
76
#'SeqIn'{boolIn = false,
78
?line {ok,{'Seq1',true,17,[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}]}} =
79
asn1_wrapper:decode('SeqOf','Seq1',lists:flatten(Bytes13)),
87
asn1_wrapper:encode('SeqOf','Seq2',#'Seq2'{bool2 = true,
90
?line {ok,{'Seq2',[],true,17}} =
91
asn1_wrapper:decode('SeqOf','Seq2',lists:flatten(Bytes21)),
95
asn1_wrapper:encode('SeqOf','Seq2',#'Seq2'{bool2 = true,
97
seq2 = [#'SeqIn'{boolIn = true,
99
?line {ok,{'Seq2',[{'SeqIn',true,25}],true,17}} =
100
asn1_wrapper:decode('SeqOf','Seq2',lists:flatten(Bytes22)),
104
asn1_wrapper:encode('SeqOf','Seq2',#'Seq2'{bool2 = true,
106
seq2 = [#'SeqIn'{boolIn = true,
108
#'SeqIn'{boolIn = false,
110
#'SeqIn'{boolIn = false,
112
?line {ok,{'Seq2',[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}],true,17}} =
113
asn1_wrapper:decode('SeqOf','Seq2',lists:flatten(Bytes23)),
121
asn1_wrapper:encode('SeqOf','Seq3',#'Seq3'{bool3 = true,
123
?line {ok,{'Seq3',true,[],17}} =
124
asn1_wrapper:decode('SeqOf','Seq3',lists:flatten(Bytes31)),
128
asn1_wrapper:encode('SeqOf','Seq3',#'Seq3'{bool3 = true,
130
seq3 = [#'SeqIn'{boolIn = true,
132
?line {ok,{'Seq3',true,[{'SeqIn',true,25}],17}} =
133
asn1_wrapper:decode('SeqOf','Seq3',lists:flatten(Bytes32)),
137
asn1_wrapper:encode('SeqOf','Seq3',#'Seq3'{bool3 = true,
139
seq3 = [#'SeqIn'{boolIn = true,
141
#'SeqIn'{boolIn = false,
143
#'SeqIn'{boolIn = false,
145
?line {ok,{'Seq3',true,[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}],17}} =
146
asn1_wrapper:decode('SeqOf','Seq3',lists:flatten(Bytes33)),
154
?line {ok,Bytes41} = asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{}),
155
?line {ok,{'Seq4',[],[],[]}} = asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes41)),
159
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq41 = [#'SeqIn'{boolIn = true,
161
?line {ok,{'Seq4',[{'SeqIn',true,25}],[],[]}} =
162
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes42)),
166
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq41 = [#'SeqIn'{boolIn = true,
168
#'SeqIn'{boolIn = false,
170
#'SeqIn'{boolIn = false,
172
?line {ok,{'Seq4',[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}],[],[]}} =
173
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes43)),
177
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq42 = [#'SeqIn'{boolIn = true,
179
?line {ok,{'Seq4',[],[{'SeqIn',true,25}],[]}} =
180
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes44)),
184
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq42 = [#'SeqIn'{boolIn = true,
186
#'SeqIn'{boolIn = false,
188
#'SeqIn'{boolIn = false,
190
?line {ok,{'Seq4',[],[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}],[]}} =
191
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes45)),
195
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq43 = [#'SeqIn'{boolIn = true,
197
?line {ok,{'Seq4',[],[],[{'SeqIn',true,25}]}} =
198
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes46)),
202
asn1_wrapper:encode('SeqOf','Seq4',#'Seq4'{seq43 = [#'SeqIn'{boolIn = true,
204
#'SeqIn'{boolIn = false,
206
#'SeqIn'{boolIn = false,
208
?line {ok,{'Seq4',[],[],[{'SeqIn',true,25},{'SeqIn',false,125},{'SeqIn',false,225}]}} =
209
asn1_wrapper:decode('SeqOf','Seq4',lists:flatten(Bytes47)),
212
?line {ok,Bytes51} = asn1_wrapper:encode('SeqOf','SeqEmp',#'SeqEmp'{seq1 = [#'Empty'{}]}),
213
?line {ok,{'SeqEmp',[{'Empty'}]}} = asn1_wrapper:decode('SeqOf','SeqEmp',lists:flatten(Bytes51)),
217
?line {ok,Bytes52} = asn1_wrapper:encode('SeqOfEnum','SeqOfEnum',
218
{'SeqOfEnum',[{'Enum',a},{'Enum',b}]}),
219
?line {ok,[a,b]} = asn1_wrapper:decode('SeqOfEnum','SeqOfEnum',
220
lists:flatten(Bytes52));
226
PER when PER == per; PER == per_bin ->
227
DayNames = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
228
?line {ok,Bytes60} = asn1_wrapper:encode('XSeqOf','DayNames2',DayNames),
229
?line {ok,Bytes60} = asn1_wrapper:encode('XSeqOf','DayNames4',DayNames),
230
?line {ok,DayNames} = asn1_wrapper:decode('XSeqOf','DayNames2',Bytes60),
231
?line {ok,DayNames} = asn1_wrapper:decode('XSeqOf','DayNames4',Bytes60),
232
?line {ok,Bytes61} = asn1_wrapper:encode('XSeqOf','DayNames1',DayNames),
233
?line {ok,Bytes61} = asn1_wrapper:encode('XSeqOf','DayNames3',DayNames),
234
?line {ok,DayNames} = asn1_wrapper:decode('XSeqOf','DayNames1',Bytes61),
235
?line {ok,DayNames} = asn1_wrapper:decode('XSeqOf','DayNames3',Bytes61);