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
31
-include_lib("test_server/include/test_server.hrl").
35
compile(Config,Rules,Opt) ->
37
?line DataDir = ?config(data_dir,Config),
38
?line OutDir = ?config(priv_dir,Config),
39
?line true = code:add_patha(?config(priv_dir,Config)),
42
?line ok = asn1ct:compile(DataDir ++ "Prim",
43
[Rules,optimize,{outdir,OutDir}]),
44
?line ok = asn1ct:compile(DataDir ++ "Real",
45
[Rules,optimize,{outdir,OutDir}]);
47
?line ok = asn1ct:compile(DataDir ++ "Prim",
48
[Rules,{outdir,OutDir}]),
49
?line ok = asn1ct:compile(DataDir ++ "Real",
50
[Rules,{outdir,OutDir}])
58
%%==========================================================
60
%%==========================================================
62
?line {ok,Bytes1} = asn1_wrapper:encode('Prim','Bool',true),
63
?line {ok,true} = asn1_wrapper:decode('Prim','Bool',lists:flatten(Bytes1)),
65
?line {ok,Bytes2} = asn1_wrapper:encode('Prim','Bool',false),
66
?line {ok,false} = asn1_wrapper:decode('Prim','Bool',lists:flatten(Bytes2)),
68
?line case asn1_wrapper:erule(Rules) of
70
?line {error,{asn1,{encode_boolean,517}}} =
71
(catch asn1_wrapper:encode('Prim','Bool',517)),
81
%%==========================================================
82
%% BoolCon ::= [20] BOOLEAN
83
%%==========================================================
86
?line {ok,BytesCon1} = asn1_wrapper:encode('Prim','BoolCon',true),
87
?line {ok,true} = asn1_wrapper:decode('Prim','BoolCon',lists:flatten(BytesCon1)),
89
?line {ok,BytesCon2} = asn1_wrapper:encode('Prim','BoolCon',false),
90
?line {ok,false} = asn1_wrapper:decode('Prim','BoolCon',lists:flatten(BytesCon2)),
92
?line case asn1_wrapper:erule(Rules) of
94
?line {error,{asn1,{encode_boolean,517}}} =
95
(catch asn1_wrapper:encode('Prim','BoolCon',517)),
105
%%==========================================================
106
%% BoolPri ::= [PRIVATE 21] BOOLEAN
107
%%==========================================================
109
?line {ok,BytesPri1} = asn1_wrapper:encode('Prim','BoolPri',true),
110
?line {ok,true} = asn1_wrapper:decode('Prim','BoolPri',lists:flatten(BytesPri1)),
112
?line {ok,BytesPri2} = asn1_wrapper:encode('Prim','BoolPri',false),
113
?line {ok,false} = asn1_wrapper:decode('Prim','BoolPri',lists:flatten(BytesPri2)),
115
?line case asn1_wrapper:erule(Rules) of
117
?line {error,{asn1,{encode_boolean,517}}} =
118
(catch asn1_wrapper:encode('Prim','BoolPri',517)),
125
%%==========================================================
126
%% BoolApp ::= [APPLICATION 22] BOOLEAN
127
%%==========================================================
129
?line {ok,BytesApp1} = asn1_wrapper:encode('Prim','BoolApp',true),
130
?line {ok,true} = asn1_wrapper:decode('Prim','BoolApp',lists:flatten(BytesApp1)),
132
?line {ok,BytesApp2} = asn1_wrapper:encode('Prim','BoolApp',false),
133
?line {ok,false} = asn1_wrapper:decode('Prim','BoolApp',lists:flatten(BytesApp2)),
135
?line case asn1_wrapper:erule(Rules) of
137
?line {error,{asn1,{encode_boolean,517}}} =
138
(catch asn1_wrapper:encode('Prim','BoolApp',517)),
145
%%==========================================================
146
%% BoolExpCon ::= [30] EXPLICIT BOOLEAN
147
%%==========================================================
149
?line {ok,BytesExpCon1} = asn1_wrapper:encode('Prim','BoolExpCon',true),
150
?line {ok,true} = asn1_wrapper:decode('Prim','BoolExpCon',lists:flatten(BytesExpCon1)),
152
?line {ok,BytesExpCon2} = asn1_wrapper:encode('Prim','BoolExpCon',false),
153
?line {ok,false} = asn1_wrapper:decode('Prim','BoolExpCon',lists:flatten(BytesExpCon2)),
155
?line case asn1_wrapper:erule(Rules) of
157
?line {error,{asn1,{encode_boolean,517}}} =
158
(catch asn1_wrapper:encode('Prim','BoolExpCon',517)),
166
%%==========================================================
167
%% BoolExpPri ::= [PRIVATE 31] EXPLICIT BOOLEAN
168
%%==========================================================
170
?line {ok,BytesExpPri1} = asn1_wrapper:encode('Prim','BoolExpPri',true),
171
?line {ok,true} = asn1_wrapper:decode('Prim','BoolExpPri',lists:flatten(BytesExpPri1)),
173
?line {ok,BytesExpPri2} = asn1_wrapper:encode('Prim','BoolExpPri',false),
174
?line {ok,false} = asn1_wrapper:decode('Prim','BoolExpPri',lists:flatten(BytesExpPri2)),
176
?line case asn1_wrapper:erule(Rules) of
178
?line {error,{asn1,{encode_boolean,517}}} =
179
(catch asn1_wrapper:encode('Prim','BoolExpPri',517)),
186
%%==========================================================
187
%% BoolExpApp ::= [APPLICATION 32] EXPLICIT BOOLEAN
188
%%==========================================================
190
?line {ok,BytesExpApp1} = asn1_wrapper:encode('Prim','BoolExpApp',true),
191
?line {ok,true} = asn1_wrapper:decode('Prim','BoolExpApp',lists:flatten(BytesExpApp1)),
193
?line {ok,BytesExpApp2} = asn1_wrapper:encode('Prim','BoolExpApp',false),
194
?line {ok,false} = asn1_wrapper:decode('Prim','BoolExpApp',lists:flatten(BytesExpApp2)),
196
?line case asn1_wrapper:erule(Rules) of
198
?line {error,{asn1,{encode_boolean,517}}} =
199
(catch asn1_wrapper:encode('Prim','BoolExpApp',517)),
211
%%==========================================================
213
%%==========================================================
215
%% test of OTP-2666 encoding should use minimum number of octets x.690 8.3.2
216
?line {ok,Bytes0} = asn1_wrapper:encode('Prim','Int',-128),
217
?line L0 = lists:flatten(Bytes0),
218
?line {ok,-128} = asn1_wrapper:decode('Prim','Int',lists:flatten(L0)),
219
case asn1_wrapper:erule(Rules) of
221
?line [_,1,128] = L0;
225
?line {ok,Bytes1} = asn1_wrapper:encode('Prim','Int',4),
226
?line {ok,4} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes1)),
228
?line {ok,Bytes2} = asn1_wrapper:encode('Prim','Int',444),
229
?line {ok,444} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes2)),
231
?line {ok,Bytes3} = asn1_wrapper:encode('Prim','Int',123456789),
232
?line {ok,123456789} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes3)),
234
?line {ok,Bytes4} = asn1_wrapper:encode('Prim','Int',12345678901234567890),
235
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes4)),
237
?line {ok,Bytes5} = asn1_wrapper:encode('Prim','Int',-100),
238
?line {ok,-100} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes5)),
240
?line {ok,Bytes6} = asn1_wrapper:encode('Prim','Int',-255),
241
?line {ok,-255} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes6)),
243
?line {ok,Bytes7} = asn1_wrapper:encode('Prim','Int',-256),
244
?line {ok,-256} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes7)),
246
?line {ok,Bytes8} = asn1_wrapper:encode('Prim','Int',-257),
247
?line {ok,-257} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes8)),
249
?line {ok,Bytes9} = asn1_wrapper:encode('Prim','Int',-1234567890),
250
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes9)),
252
?line {ok,Bytes10} = asn1_wrapper:encode('Prim','Int',-2147483648),
253
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(Bytes10)),
259
%%==========================================================
260
%% IntCon ::= [40] INTEGER
261
%%==========================================================
263
?line {ok,BytesCon1} = asn1_wrapper:encode('Prim','IntCon',4),
264
?line {ok,4} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon1)),
266
?line {ok,BytesCon2} = asn1_wrapper:encode('Prim','IntCon',444),
267
?line {ok,444} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon2)),
269
?line {ok,BytesCon3} = asn1_wrapper:encode('Prim','IntCon',123456789),
270
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon3)),
272
?line {ok,BytesCon4} = asn1_wrapper:encode('Prim','IntCon',12345678901234567890),
273
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon4)),
275
?line {ok,BytesCon5} = asn1_wrapper:encode('Prim','IntCon',-100),
276
?line {ok,-100} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon5)),
278
?line {ok,BytesCon6} = asn1_wrapper:encode('Prim','IntCon',-255),
279
?line {ok,-255} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon6)),
281
?line {ok,BytesCon7} = asn1_wrapper:encode('Prim','IntCon',-256),
282
?line {ok,-256} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon7)),
284
?line {ok,BytesCon8} = asn1_wrapper:encode('Prim','IntCon',-257),
285
?line {ok,-257} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon8)),
287
?line {ok,BytesCon9} = asn1_wrapper:encode('Prim','IntCon',-1234567890),
288
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntCon',lists:flatten(BytesCon9)),
290
?line {ok,BytesCon10} = asn1_wrapper:encode('Prim','Int',-2147483648),
291
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesCon10)),
295
%%==========================================================
296
%% IntPri ::= [PRIVATE 41] INTEGER
297
%%==========================================================
299
?line {ok,BytesPri1} = asn1_wrapper:encode('Prim','IntPri',4),
300
?line {ok,4} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri1)),
302
?line {ok,BytesPri2} = asn1_wrapper:encode('Prim','IntPri',444),
303
?line {ok,444} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri2)),
305
?line {ok,BytesPri3} = asn1_wrapper:encode('Prim','IntPri',123456789),
306
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri3)),
308
?line {ok,BytesPri4} = asn1_wrapper:encode('Prim','IntPri',12345678901234567890),
309
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri4)),
311
?line {ok,BytesPri5} = asn1_wrapper:encode('Prim','IntPri',-100),
312
?line {ok,-100} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri5)),
314
?line {ok,BytesPri6} = asn1_wrapper:encode('Prim','IntPri',-255),
315
?line {ok,-255} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri6)),
317
?line {ok,BytesPri7} = asn1_wrapper:encode('Prim','IntPri',-256),
318
?line {ok,-256} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri7)),
320
?line {ok,BytesPri8} = asn1_wrapper:encode('Prim','IntPri',-257),
321
?line {ok,-257} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri8)),
323
?line {ok,BytesPri9} = asn1_wrapper:encode('Prim','IntPri',-1234567890),
324
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntPri',lists:flatten(BytesPri9)),
326
?line {ok,BytesPri10} = asn1_wrapper:encode('Prim','Int',-2147483648),
327
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesPri10)),
331
%%==========================================================
332
%% IntApp ::= [APPLICATION 42] INTEGER
333
%%==========================================================
335
?line {ok,BytesApp1} = asn1_wrapper:encode('Prim','IntApp',4),
336
?line {ok,4} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp1)),
338
?line {ok,BytesApp2} = asn1_wrapper:encode('Prim','IntApp',444),
339
?line {ok,444} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp2)),
341
?line {ok,BytesApp3} = asn1_wrapper:encode('Prim','IntApp',123456789),
342
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp3)),
344
?line {ok,BytesApp4} = asn1_wrapper:encode('Prim','IntApp',12345678901234567890),
345
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp4)),
347
?line {ok,BytesApp5} = asn1_wrapper:encode('Prim','IntApp',-100),
348
?line {ok,-100} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp5)),
350
?line {ok,BytesApp6} = asn1_wrapper:encode('Prim','IntApp',-255),
351
?line {ok,-255} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp6)),
353
?line {ok,BytesApp7} = asn1_wrapper:encode('Prim','IntApp',-256),
354
?line {ok,-256} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp7)),
356
?line {ok,BytesApp8} = asn1_wrapper:encode('Prim','IntApp',-257),
357
?line {ok,-257} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp8)),
359
?line {ok,BytesApp9} = asn1_wrapper:encode('Prim','IntApp',-1234567890),
360
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntApp',lists:flatten(BytesApp9)),
362
?line {ok,BytesApp10} = asn1_wrapper:encode('Prim','Int',-2147483648),
363
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesApp10)),
366
%%==========================================================
367
%% IntExpCon ::= [50] EXPLICIT INTEGER
368
%%==========================================================
370
?line {ok,BytesExpCon1} = asn1_wrapper:encode('Prim','IntExpCon',4),
371
?line {ok,4} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon1)),
373
?line {ok,BytesExpCon2} = asn1_wrapper:encode('Prim','IntExpCon',444),
374
?line {ok,444} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon2)),
376
?line {ok,BytesExpCon3} = asn1_wrapper:encode('Prim','IntExpCon',123456789),
377
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon3)),
379
?line {ok,BytesExpCon4} = asn1_wrapper:encode('Prim','IntExpCon',12345678901234567890),
380
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon4)),
382
?line {ok,BytesExpCon5} = asn1_wrapper:encode('Prim','IntExpCon',-100),
383
?line {ok,-100} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon5)),
385
?line {ok,BytesExpCon6} = asn1_wrapper:encode('Prim','IntExpCon',-255),
386
?line {ok,-255} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon6)),
388
?line {ok,BytesExpCon7} = asn1_wrapper:encode('Prim','IntExpCon',-256),
389
?line {ok,-256} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon7)),
391
?line {ok,BytesExpCon8} = asn1_wrapper:encode('Prim','IntExpCon',-257),
392
?line {ok,-257} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon8)),
394
?line {ok,BytesExpCon9} = asn1_wrapper:encode('Prim','IntExpCon',-1234567890),
395
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntExpCon',lists:flatten(BytesExpCon9)),
397
?line {ok,BytesExpCon10} = asn1_wrapper:encode('Prim','Int',-2147483648),
398
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesExpCon10)),
400
%%==========================================================
401
%% IntExpPri ::= [PRIVATE 51] EXPLICIT INTEGER
402
%%==========================================================
404
?line {ok,BytesExpPri1} = asn1_wrapper:encode('Prim','IntExpPri',4),
405
?line {ok,4} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri1)),
407
?line {ok,BytesExpPri2} = asn1_wrapper:encode('Prim','IntExpPri',444),
408
?line {ok,444} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri2)),
410
?line {ok,BytesExpPri3} = asn1_wrapper:encode('Prim','IntExpPri',123456789),
411
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri3)),
413
?line {ok,BytesExpPri4} = asn1_wrapper:encode('Prim','IntExpPri',12345678901234567890),
414
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri4)),
416
?line {ok,BytesExpPri5} = asn1_wrapper:encode('Prim','IntExpPri',-100),
417
?line {ok,-100} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri5)),
419
?line {ok,BytesExpPri6} = asn1_wrapper:encode('Prim','IntExpPri',-255),
420
?line {ok,-255} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri6)),
422
?line {ok,BytesExpPri7} = asn1_wrapper:encode('Prim','IntExpPri',-256),
423
?line {ok,-256} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri7)),
425
?line {ok,BytesExpPri8} = asn1_wrapper:encode('Prim','IntExpPri',-257),
426
?line {ok,-257} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri8)),
428
?line {ok,BytesExpPri9} = asn1_wrapper:encode('Prim','IntExpPri',-1234567890),
429
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntExpPri',lists:flatten(BytesExpPri9)),
431
?line {ok,BytesExpPri10} = asn1_wrapper:encode('Prim','Int',-2147483648),
432
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesExpPri10)),
434
%%==========================================================
435
%% IntExpApp ::= [APPLICATION 52] EXPLICIT INTEGER
436
%%==========================================================
438
?line {ok,BytesExpApp1} = asn1_wrapper:encode('Prim','IntExpApp',4),
439
?line {ok,4} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp1)),
441
?line {ok,BytesExpApp2} = asn1_wrapper:encode('Prim','IntExpApp',444),
442
?line {ok,444} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp2)),
444
?line {ok,BytesExpApp3} = asn1_wrapper:encode('Prim','IntExpApp',123456789),
445
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp3)),
447
?line {ok,BytesExpApp4} = asn1_wrapper:encode('Prim','IntExpApp',12345678901234567890),
448
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp4)),
450
?line {ok,BytesExpApp5} = asn1_wrapper:encode('Prim','IntExpApp',-100),
451
?line {ok,-100} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp5)),
453
?line {ok,BytesExpApp6} = asn1_wrapper:encode('Prim','IntExpApp',-255),
454
?line {ok,-255} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp6)),
456
?line {ok,BytesExpApp7} = asn1_wrapper:encode('Prim','IntExpApp',-256),
457
?line {ok,-256} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp7)),
459
?line {ok,BytesExpApp8} = asn1_wrapper:encode('Prim','IntExpApp',-257),
460
?line {ok,-257} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp8)),
462
?line {ok,BytesExpApp9} = asn1_wrapper:encode('Prim','IntExpApp',-1234567890),
463
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntExpApp',lists:flatten(BytesExpApp9)),
465
?line {ok,BytesExpApp10} = asn1_wrapper:encode('Prim','Int',-2147483648),
466
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesExpApp10)),
469
%%==========================================================
470
%% IntEnum ::= INTEGER {first(1),last(31)}
471
%%==========================================================
473
?line {ok,BytesEnum1} = asn1_wrapper:encode('Prim','IntEnum',4),
474
?line {ok,4} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum1)),
476
?line {ok,BytesEnum2} = asn1_wrapper:encode('Prim','IntEnum',444),
477
?line {ok,444} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum2)),
479
?line {ok,BytesEnum3} = asn1_wrapper:encode('Prim','IntEnum',123456789),
480
?line {ok,123456789} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum3)),
482
?line {ok,BytesEnum4} = asn1_wrapper:encode('Prim','IntEnum',12345678901234567890),
483
?line {ok,12345678901234567890} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum4)),
485
?line {ok,BytesEnum5} = asn1_wrapper:encode('Prim','IntEnum',-100),
486
?line {ok,-100} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum5)),
488
?line {ok,BytesEnum6} = asn1_wrapper:encode('Prim','IntEnum',-255),
489
?line {ok,-255} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum6)),
491
?line {ok,BytesEnum7} = asn1_wrapper:encode('Prim','IntEnum',-256),
492
?line {ok,-256} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum7)),
494
?line {ok,BytesEnum8} = asn1_wrapper:encode('Prim','IntEnum',-257),
495
?line {ok,-257} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum8)),
497
?line {ok,BytesEnum9} = asn1_wrapper:encode('Prim','IntEnum',-1234567890),
498
?line {ok,-1234567890} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum9)),
500
?line {ok,BytesEnum910} = asn1_wrapper:encode('Prim','Int',-2147483648),
501
?line {ok,-2147483648} = asn1_wrapper:decode('Prim','Int',lists:flatten(BytesEnum910)),
504
?line {ok,BytesEnum10} = asn1_wrapper:encode('Prim','IntEnum',first),
505
?line {ok,first} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum10)),
507
?line {ok,BytesEnum11} = asn1_wrapper:encode('Prim','IntEnum',last),
508
?line {ok,last} = asn1_wrapper:decode('Prim','IntEnum',lists:flatten(BytesEnum11)),
518
%%==========================================================
519
%% Enum ::= ENUMERATED {monday(1),tuesday(2),wednesday(3),thursday(4),
520
%% friday(5),saturday(6),sunday(7)}
521
%%==========================================================
523
?line {ok,BytesEnum1} = asn1_wrapper:encode('Prim','Enum',monday),
524
?line {ok,monday} = asn1_wrapper:decode('Prim','Enum',lists:flatten(BytesEnum1)),
526
?line {ok,BytesEnum2} = asn1_wrapper:encode('Prim','Enum',thursday),
527
?line {ok,thursday} = asn1_wrapper:decode('Prim','Enum',lists:flatten(BytesEnum2)),
530
?line case asn1_wrapper:erule(Rules) of
532
?line {error,{asn1,{_,4}}} =
533
case catch asn1_wrapper:encode('Prim','Enum',4) of Enum -> Enum end,
536
?line {error,{asn1,{_,4}}} =
537
case catch asn1_wrapper:encode('Prim','Enum',4) of Enum -> Enum end,
546
%%==========================================================
547
%% ObjId ::= OBJECT IDENTIFIER
548
%%==========================================================
550
?line {ok,Bytes1} = asn1_wrapper:encode('Prim','ObjId',{0,22,3}),
551
?line {ok,{0,22,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes1)),
553
?line {ok,Bytes2} = asn1_wrapper:encode('Prim','ObjId',{1,39,3}),
554
?line {ok,{1,39,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes2)),
556
?line {ok,Bytes3} = asn1_wrapper:encode('Prim','ObjId',{2,100,3}),
557
?line {ok,{2,100,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes3)),
559
?line {ok,Bytes4} = asn1_wrapper:encode('Prim','ObjId',{2,16303,3}),
560
?line {ok,{2,16303,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes4)),
562
?line case asn1_wrapper:erule(Rules) of
564
?line {ok,Bytes5} = asn1_wrapper:encode('Prim','ObjId',{2,16304,3}),
565
?line {ok,{2,16304,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes5)),
568
?line {ok,Bytes5} = asn1_wrapper:encode('Prim','ObjId',{2,16304,3}),
569
?line {ok,{2,16304,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes5)),
570
%% ?line test_server:format("~p~n",[Kurt]),
571
% ?line {ok,{2,16304,3}} = asn1_wrapper:decode('Prim','ObjId',lists:flatten(Bytes5)),
581
%%==========================================================
582
%% RelOid ::= RELATIVE-OID
583
%%==========================================================
585
?line {ok,Bytes1} = asn1_wrapper:encode('Prim','RelOid',{0,22,3}),
586
?line {ok,{0,22,3}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes1)),
588
?line {ok,Bytes2} = asn1_wrapper:encode('Prim','RelOid',{1,39,3}),
589
?line {ok,{1,39,3}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes2)),
591
?line {ok,Bytes3} = asn1_wrapper:encode('Prim','RelOid',{2,100,3}),
592
?line {ok,{2,100,3}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes3)),
594
?line {ok,Bytes4} = asn1_wrapper:encode('Prim','RelOid',{2,16303,3}),
595
?line {ok,{2,16303,3}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes4)),
597
?line {ok,Bytes5} = asn1_wrapper:encode('Prim','RelOid',{2,16304,3}),
598
?line {ok,{2,16304,3}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes5)),
600
?line {ok,Bytes6} = asn1_wrapper:encode('Prim','RelOid',{8,16304,16#ffff}),
601
?line {ok,{8,16304,16#ffff}} = asn1_wrapper:decode('Prim','RelOid',lists:flatten(Bytes6)),
613
%%==========================================================
615
%%==========================================================
617
?line {ok,Bytes1} = asn1_wrapper:encode('Prim','Null',monday),
618
?line {ok,'NULL'} = asn1_wrapper:decode('Prim','Null',lists:flatten(Bytes1)),
627
%%==========================================================
628
%% AngleInRadians ::= REAL
629
%%==========================================================
632
?line {ok,Bytes1} = asn1_wrapper:encode('Real','AngleInRadians',{1,2,1}),
633
?line {ok,{1,2,1}} = asn1_wrapper:decode('Real','AngleInRadians',Bytes1),
635
?line {ok,Bytes2} = asn1_wrapper:encode('Real','AngleInRadians',{129,2,1}),
636
?line {ok,{129,2,1}} = asn1_wrapper:decode('Real','AngleInRadians',Bytes2),
638
?line {ok,Bytes3} = asn1_wrapper:encode('Real','AngleInRadians',{128,2,1}),
639
?line {ok,{1,2,8}} = asn1_wrapper:decode('Real','AngleInRadians',Bytes3),
641
?line {ok,Bytes4} = asn1_wrapper:encode('Real','AngleInRadians',{128,2,-7}),
642
?line {ok,{1,2,0}} = asn1_wrapper:decode('Real','AngleInRadians',Bytes4),
644
?line {ok,Bytes5} = asn1_wrapper:encode('Real','AngleInRadians',{16#f1f1f1,2,128}),
645
?line {ok,{16#f1f1f1,2,128}} = asn1_wrapper:decode('Real','AngleInRadians',Bytes5),
647
%% Base 10, tuple format
648
?line {ok,Bytes6} = asn1_wrapper:encode('Real','AngleInRadians',{1,10,1}),
649
?line {ok,"1.E1"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes6),
651
?line {ok,Bytes7} = asn1_wrapper:encode('Real','AngleInRadians',{100,10,1}),
652
?line {ok,"1.E3"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes7),
654
?line {ok,Bytes8} = asn1_wrapper:encode('Real','AngleInRadians',{-100,10,1}),
655
?line {ok,"-1.E3"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes8),
657
?line {ok,Bytes9} = asn1_wrapper:encode('Real','AngleInRadians',{00002,10,1}),
658
?line {ok,"2.E1"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes9),
660
?line {ok,Bytes10} = asn1_wrapper:encode('Real','AngleInRadians',{123000,10,0}),
661
?line {ok,"123.E3"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes10),
663
?line {ok,Bytes11} = asn1_wrapper:encode('Real','AngleInRadians',{123456789,10,123456789}),
664
?line {ok,"123456789.E123456789"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes11),
666
?line {ok,Bytes12} = asn1_wrapper:encode('Real','AngleInRadians',{-12345,10,-12345}),
667
?line {ok,"-12345.E-12345"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes12),
669
%% Base 10, string format NR3
671
?line {ok,Bytes13} = asn1_wrapper:encode('Real','AngleInRadians',"123.123E123"),
672
?line {ok,"123123.E120"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes13),
674
?line {ok,Bytes14} = asn1_wrapper:encode('Real','AngleInRadians',"0.0E0"),
675
?line {ok,"0.E+0"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes14),
677
?line {ok,Bytes15} = asn1_wrapper:encode('Real','AngleInRadians',"0.0123"),
678
?line {ok,"123.E-4"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes15),
680
?line {ok,Bytes16} = asn1_wrapper:encode('Real','AngleInRadians',"0"),
681
?line {ok,"0.E+0"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes16),
683
?line {ok,Bytes17} = asn1_wrapper:encode('Real','AngleInRadians',"-123.45"),
684
?line {ok,"-12345.E-2"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes17),
687
asn1_wrapper:encode('Real','AngleInRadians',"123456789E123456789"),
688
?line {ok,"123456789.E123456789"} =
689
asn1_wrapper:decode('Real','AngleInRadians',Bytes18),
691
?line {ok,Bytes19} = asn1_wrapper:encode('Real','AngleInRadians',"01.000E1"),
692
?line {ok,"1.E1"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes19),
694
?line {ok,Bytes20} = asn1_wrapper:encode('Real','AngleInRadians',"120.0001"),
695
?line {ok,"1200001.E-4"} = asn1_wrapper:decode('Real','AngleInRadians',Bytes20).