~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

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(testSetExtension).
 
21
 
 
22
 
 
23
-include("External.hrl").
 
24
-export([compile/3]).
 
25
-export([main/1]).
 
26
 
 
27
-include("test_server.hrl").
 
28
 
 
29
-record('SetExt1',{}).
 
30
-record('SetExt2',{bool, int}).
 
31
-record('SetExt3',{bool, int}).
 
32
-record('SetExt4',{bool, int}).
 
33
 
 
34
 
 
35
compile(Config,Rules,Options) ->
 
36
 
 
37
    ?line DataDir = ?config(data_dir,Config),
 
38
    ?line OutDir = ?config(priv_dir,Config),
 
39
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
40
    ?line ok = asn1ct:compile(DataDir ++ "SetExtension",
 
41
                              [Rules,{outdir,OutDir}]++Options).
 
42
 
 
43
 
 
44
 
 
45
main(_Rules) ->
 
46
    
 
47
    ?line {ok,Bytes11} = 
 
48
        asn1_wrapper:encode('SetExtension','SetExt1',#'SetExt1'{}), 
 
49
    ?line {ok,{'SetExt1'}} = 
 
50
        asn1_wrapper:decode('SetExtension','SetExt1',lists:flatten(Bytes11)),
 
51
 
 
52
    ?line {ok,Bytes21} = 
 
53
        asn1_wrapper:encode('SetExtension','SetExt2',#'SetExt2'{bool = true,int = 99}), 
 
54
    ?line {ok,{'SetExt2',true,99}} = 
 
55
        asn1_wrapper:decode('SetExtension','SetExt2',lists:flatten(Bytes21)),
 
56
 
 
57
    ?line {ok,Bytes22} = 
 
58
        asn1_wrapper:encode('SetExtension','SetExt2',#'SetExt2'{int = 99,bool = true}), 
 
59
    ?line {ok,{'SetExt2',true,99}} = 
 
60
        asn1_wrapper:decode('SetExtension','SetExt2',lists:flatten(Bytes22)),
 
61
 
 
62
    ?line {ok,Bytes31} = 
 
63
        asn1_wrapper:encode('SetExtension','SetExt3',#'SetExt3'{bool = true,int = 99}), 
 
64
    ?line {ok,{'SetExt3',true,99}} = 
 
65
        asn1_wrapper:decode('SetExtension','SetExt3',lists:flatten(Bytes31)),
 
66
 
 
67
    ?line {ok,Bytes32} = 
 
68
        asn1_wrapper:encode('SetExtension','SetExt3',#'SetExt3'{int = 99,bool = true}), 
 
69
    ?line {ok,{'SetExt3',true,99}} = 
 
70
        asn1_wrapper:decode('SetExtension','SetExt3',lists:flatten(Bytes32)),
 
71
 
 
72
    ?line {ok,Bytes41} = 
 
73
        asn1_wrapper:encode('SetExtension','SetExt4',#'SetExt4'{bool = true,int = 99}), 
 
74
    ?line {ok,{'SetExt4',true,99}} = 
 
75
        asn1_wrapper:decode('SetExtension','SetExt4',lists:flatten(Bytes41)),
 
76
 
 
77
    ?line {ok,Bytes42} = 
 
78
        asn1_wrapper:encode('SetExtension','SetExt4',#'SetExt4'{int = 99,bool = true}), 
 
79
    ?line {ok,{'SetExt4',true,99}} = 
 
80
        asn1_wrapper:decode('SetExtension','SetExt4',lists:flatten(Bytes42)),
 
81
 
 
82
 
 
83
    %% Test of extension , needs to be improved and extended
 
84
    
 
85
     ?line {ok,BytesX11} = 
 
86
        asn1_wrapper:encode('SetExtension','SetExt1',#'SetExt1'{}), 
 
87
    ?line {ok,{'SetExt1'}} = 
 
88
        asn1_wrapper:decode('SetExtension','SetExt1',lists:flatten(BytesX11)),
 
89
 
 
90
    ?line {ok,BytesX21} = 
 
91
        asn1_wrapper:encode('SetExtension','SetExt2',#'SetExt2'{bool = true,int = 99}), 
 
92
    ?line {ok,{'SetExt2',true,99}} = 
 
93
        asn1_wrapper:decode('SetExtension','SetExt2',lists:flatten(BytesX21)),
 
94
 
 
95
    ?line {ok,BytesX22} = 
 
96
        asn1_wrapper:encode('SetExtension','SetExt2',#'SetExt2'{int = 99,bool = true}), 
 
97
    ?line {ok,{'SetExt2',true,99}} = 
 
98
        asn1_wrapper:decode('SetExtension','SetExt2',lists:flatten(BytesX22)),
 
99
 
 
100
   
 
101
    
 
102
     
 
103
 
 
104
    ok.
 
105
 
 
106