~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/asn1/test/testSetOf.erl

  • Committer: Elliot Murphy
  • Date: 2010-06-08 03:55:44 UTC
  • mfrom: (3.5.6 squeeze)
  • Revision ID: elliot@elliotmurphy.com-20100608035544-dd8zh2swk7jr5rz2
* Merge with Debian unstable; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
* Added missing symlinks to /usr/include for a few new header files.
* Fixed generation of ${erlang-base:Depends} and ${erlang-x11:Depends}
  substitution variables.
* Added a fix for a re:compile/2 crash on a long regular expression.
* Changed urgency to medium as the change fixes a security bug.
* Manpages in section 1 are needed even if only arch-dependent packages are
  built. So, re-enabled them.
* Fixed HiPE architecture recognition for powerpc Debian architecture.
* Moved xsltproc and fop to build-depends-indep and do not build
  documentation if only architecture-specific packages are built.
* Refreshed all patches.
* Made Emacs look in man5 and man7 for Erlang manpages and added code
  skeleton files to erlang-mode package.
* New upstream release.
* Moved manpages from incorrect sections 4 and 6 to correct 5 and 7
  (closes: #498492).
* Made manpages regexp in Emacs mode match only 3erl pages in section 3.
* Removed docb_gen script which is no longer needed to build manpages.
* Added erlang-doc package which contains documentation in HTML and PDF
  formats. This package replaces erlang-doc-html package and it's easier
  to synchronize it with the main Erlang packages as it's built from
  a single source package (closes: #558451).
* Removed RPATH from ssl and crypto application binaries as required by
  Debian policy.
* Added libwxgtk2.4-dev and libwxgtk2.6-dev to build conflicts.
* Added a few dpendencies for erlang-dialyzer, erlang-et, erlang-observer
  and erlang-examples packages which now call functions from more modules
  than in 1:13.b.3.
* Added a workaround which disables vfork() for hppa architecture
  (closes: #562218).
* Strictened check for JDK 1.5 adding a call to String(int[], int, int)
  because GCJ 4.4 doesn't implement it and OpenJDK isn't available for all
  architectures.
* Fixed erlang-manpages package section.
* Made erlang-depends add only substvars which are requested in
  debian/control file. This minimizes number of warnings from dh_gencontrol.
  Also, improved descriptions of the functions in erlang-depends escript.
* Added erlang-erl-docgen package to erlang-nox dependencies.
* Made dummy packages erlang-nox and erlang-x11 architecture all.
* Cleaned up working with custom substitution variables in debian/rules.
* Reorganized debian/rules to ensure that manpages arent built twice, and
  aren't built at all if only architecture-dependent packages are requested.
* Fixed project links in README.Debian.
* Added a new package erlang-jinterface which provides tools for
  communication of Java programs with Erlang processes. This adds build
  depandency on default-jdk and as a result enables Java module for IDL
  compiler.
* Bumped standards version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
5
%% 
 
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/.
 
11
%% 
 
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
 
15
%% under the License.
 
16
%% 
 
17
%% %CopyrightEnd%
 
18
%%
 
19
%%
 
20
-module(testSetOf).
 
21
 
 
22
-export([compile/3]).
 
23
-export([main/1]).
 
24
 
 
25
-include("test_server.hrl").
 
26
 
 
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}).
 
36
-record('Empty',{}).
 
37
 
 
38
 
 
39
 
 
40
compile(Config,Rules,Options) ->
 
41
 
 
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).
 
46
 
 
47
 
 
48
 
 
49
main(_Rules) ->
 
50
 
 
51
    ?line {ok,Bytes11} = 
 
52
        asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
 
53
                                             int1 = 17}),
 
54
    ?line {ok,{'Set1',true,17,[]}} = 
 
55
        asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes11)),
 
56
    
 
57
    
 
58
    ?line {ok,Bytes12} = 
 
59
        asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
 
60
                                             int1 = 17,
 
61
                                             set1 = [#'SetIn'{boolIn = true,
 
62
                                                              intIn = 25}]}),
 
63
    ?line {ok,{'Set1',true,17,[{'SetIn',true,25}]}} = 
 
64
        asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes12)),
 
65
    
 
66
    
 
67
    
 
68
    ?line {ok,Bytes13} = 
 
69
        asn1_wrapper:encode('SetOf','Set1',#'Set1'{bool1 = true,
 
70
                                             int1 = 17,
 
71
                                             set1 = [#'SetIn'{boolIn = true,
 
72
                                                              intIn = 25},
 
73
                                                     #'SetIn'{boolIn = false,
 
74
                                                              intIn = 125},
 
75
                                                     #'SetIn'{boolIn = false,
 
76
                                                              intIn = 225}]}),
 
77
    ?line {ok,{'Set1',true,17,[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}]}} = 
 
78
        asn1_wrapper:decode('SetOf','Set1',lists:flatten(Bytes13)),
 
79
 
 
80
 
 
81
 
 
82
 
 
83
 
 
84
 
 
85
    ?line {ok,Bytes21} = 
 
86
        asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
 
87
                                             int2 = 17}),
 
88
    
 
89
    ?line {ok,{'Set2',[],true,17}} = 
 
90
        asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes21)),
 
91
    
 
92
    
 
93
    ?line {ok,Bytes22} = 
 
94
        asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
 
95
                                             int2 = 17,
 
96
                                             set2 = [#'SetIn'{boolIn = true,
 
97
                                                              intIn = 25}]}),
 
98
    ?line {ok,{'Set2',[{'SetIn',true,25}],true,17}} = 
 
99
        asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes22)),
 
100
    
 
101
    
 
102
    ?line {ok,Bytes23} = 
 
103
        asn1_wrapper:encode('SetOf','Set2',#'Set2'{bool2 = true,
 
104
                                             int2 = 17,
 
105
                                             set2 = [#'SetIn'{boolIn = true,
 
106
                                                              intIn = 25},
 
107
                                                     #'SetIn'{boolIn = false,
 
108
                                                              intIn = 125},
 
109
                                                     #'SetIn'{boolIn = false,
 
110
                                                              intIn = 225}]}),
 
111
    ?line {ok,{'Set2',[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],true,17}} = 
 
112
        asn1_wrapper:decode('SetOf','Set2',lists:flatten(Bytes23)),
 
113
    
 
114
    
 
115
 
 
116
 
 
117
 
 
118
    
 
119
    ?line {ok,Bytes31} = 
 
120
        asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
 
121
                                             int3 = 17}),
 
122
    ?line {ok,{'Set3',true,[],17}} = 
 
123
        asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes31)),
 
124
    
 
125
    
 
126
    ?line {ok,Bytes32} = 
 
127
        asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
 
128
                                             int3 = 17,
 
129
                                             set3 = [#'SetIn'{boolIn = true,
 
130
                                                              intIn = 25}]}),
 
131
    ?line {ok,{'Set3',true,[{'SetIn',true,25}],17}} = 
 
132
        asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes32)),
 
133
    
 
134
    
 
135
    ?line {ok,Bytes33} = 
 
136
        asn1_wrapper:encode('SetOf','Set3',#'Set3'{bool3 = true,
 
137
                                             int3 = 17,
 
138
                                             set3 = [#'SetIn'{boolIn = true,
 
139
                                                              intIn = 25},
 
140
                                                     #'SetIn'{boolIn = false,
 
141
                                                              intIn = 125},
 
142
                                                     #'SetIn'{boolIn = false,
 
143
                                                              intIn = 225}]}),
 
144
    ?line {ok,{'Set3',true,[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],17}} = 
 
145
        asn1_wrapper:decode('SetOf','Set3',lists:flatten(Bytes33)),
 
146
    
 
147
  
 
148
 
 
149
 
 
150
 
 
151
  
 
152
    
 
153
    ?line {ok,Bytes41} = asn1_wrapper:encode('SetOf','Set4',#'Set4'{}),
 
154
    ?line {ok,{'Set4',[],[],[]}} = asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes41)),
 
155
        
 
156
    
 
157
    ?line {ok,Bytes42} = 
 
158
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set41 = [#'SetIn'{boolIn = true,
 
159
                                                               intIn = 25}]}),
 
160
    ?line {ok,{'Set4',[{'SetIn',true,25}],[],[]}} = 
 
161
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes42)),
 
162
    
 
163
    
 
164
    ?line {ok,Bytes43} = 
 
165
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set41 = [#'SetIn'{boolIn = true,
 
166
                                                               intIn = 25},
 
167
                                                      #'SetIn'{boolIn = false,
 
168
                                                               intIn = 125},
 
169
                                                      #'SetIn'{boolIn = false,
 
170
                                                               intIn = 225}]}),
 
171
    ?line {ok,{'Set4',[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],[],[]}} = 
 
172
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes43)),
 
173
    
 
174
    
 
175
    ?line {ok,Bytes44} = 
 
176
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set42 = [#'SetIn'{boolIn = true,
 
177
                                                                       intIn = 25}]}),
 
178
    ?line {ok,{'Set4',[],[{'SetIn',true,25}],[]}} = 
 
179
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes44)),
 
180
    
 
181
    
 
182
    ?line {ok,Bytes45} = 
 
183
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set42 = [#'SetIn'{boolIn = true,
 
184
                                                               intIn = 25},
 
185
                                                      #'SetIn'{boolIn = false,
 
186
                                                               intIn = 125},
 
187
                                                      #'SetIn'{boolIn = false,
 
188
                                                               intIn = 225}]}),
 
189
    ?line {ok,{'Set4',[],[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}],[]}} = 
 
190
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes45)),
 
191
    
 
192
    
 
193
    ?line {ok,Bytes46} = 
 
194
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set43 = [#'SetIn'{boolIn = true,
 
195
                                                               intIn = 25}]}),
 
196
    ?line {ok,{'Set4',[],[],[{'SetIn',true,25}]}} = 
 
197
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes46)),
 
198
    
 
199
    
 
200
    ?line {ok,Bytes47} = 
 
201
        asn1_wrapper:encode('SetOf','Set4',#'Set4'{set43 = [#'SetIn'{boolIn = true,
 
202
                                                               intIn = 25},
 
203
                                                      #'SetIn'{boolIn = false,
 
204
                                                               intIn = 125},
 
205
                                                      #'SetIn'{boolIn = false,
 
206
                                                               intIn = 225}]}),
 
207
    ?line {ok,{'Set4',[],[],[{'SetIn',true,25},{'SetIn',false,125},{'SetIn',false,225}]}} = 
 
208
        asn1_wrapper:decode('SetOf','Set4',lists:flatten(Bytes47)),
 
209
    
 
210
 
 
211
 
 
212
 
 
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)),
 
216
     
 
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)),
 
220
     
 
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)),
 
224
     
 
225
 
 
226
 
 
227
 
 
228
 
 
229
 
 
230
    
 
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)),
 
233
     
 
234
    ok.
 
235