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

« back to all changes in this revision

Viewing changes to lib/asn1/test/testSetExternal.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(testSetExternal).
 
21
 
 
22
-include("External.hrl").
 
23
-export([compile/3]).
 
24
-export([main/1]).
 
25
 
 
26
-include("test_server.hrl").
 
27
 
 
28
 
 
29
-record('SetXSeq1',{seq, bool, int}).
 
30
-record('SetXSeq2',{bool, seq, int}).
 
31
-record('SetXSeq3',{bool, int, seq}).
 
32
%-record('NT',{os, bool}).
 
33
%-record('Imp',{os, bool}).
 
34
%-record('Exp',{os, bool}).
 
35
 
 
36
 
 
37
compile(Config,Rules,Options) ->
 
38
 
 
39
    ?line DataDir = ?config(data_dir,Config),
 
40
    ?line OutDir = ?config(priv_dir,Config),
 
41
    ?line true = code:add_patha(?config(priv_dir,Config)),
 
42
    ?line ok = asn1ct:compile(DataDir ++ "SetExternal",
 
43
                              [Rules,{outdir,OutDir}]++Options).
 
44
 
 
45
 
 
46
 
 
47
main(_Rules) ->
 
48
 
 
49
    ?line {ok,Bytes11} = 
 
50
        asn1_wrapper:encode('SetExternal','XNTNT',#'XSetNT'{bool = true, os = "kalle"}),
 
51
    ?line {ok,{'XSetNT',[107,97,108,108,101],true}} = 
 
52
        asn1_wrapper:decode('SetExternal','XNTNT',lists:flatten(Bytes11)),
 
53
 
 
54
    ?line {ok,Bytes12} = 
 
55
        asn1_wrapper:encode('SetExternal','XImpNT',#'XSetNT'{bool = true, os = "kalle"}),
 
56
    ?line {ok,{'XSetNT',[107,97,108,108,101],true}} = 
 
57
        asn1_wrapper:decode('SetExternal','XImpNT',lists:flatten(Bytes12)),
 
58
 
 
59
    ?line {ok,Bytes13} = 
 
60
        asn1_wrapper:encode('SetExternal','XExpNT',#'XSetNT'{bool = true, os = "kalle"}),
 
61
    ?line {ok,{'XSetNT',[107,97,108,108,101],true}} = 
 
62
        asn1_wrapper:decode('SetExternal','XExpNT',lists:flatten(Bytes13)),
 
63
 
 
64
    
 
65
 
 
66
    ?line {ok,Bytes21} = 
 
67
        asn1_wrapper:encode('SetExternal','XNTImp',#'XSetImp'{bool = true, os = "kalle"}),
 
68
    ?line {ok,{'XSetImp',[107,97,108,108,101],true}} = 
 
69
        asn1_wrapper:decode('SetExternal','XNTImp',lists:flatten(Bytes21)),
 
70
 
 
71
    ?line {ok,Bytes22} = 
 
72
        asn1_wrapper:encode('SetExternal','XImpImp',#'XSetImp'{bool = true, os = "kalle"}),
 
73
    ?line {ok,{'XSetImp',[107,97,108,108,101],true}} = 
 
74
        asn1_wrapper:decode('SetExternal','XImpImp',lists:flatten(Bytes22)),
 
75
 
 
76
    ?line {ok,Bytes23} = 
 
77
        asn1_wrapper:encode('SetExternal','XExpImp',#'XSetImp'{bool = true, os = "kalle"}),
 
78
    ?line {ok,{'XSetImp',[107,97,108,108,101],true}} = 
 
79
        asn1_wrapper:decode('SetExternal','XExpImp',lists:flatten(Bytes23)),
 
80
 
 
81
 
 
82
    
 
83
    ?line {ok,Bytes31} = 
 
84
        asn1_wrapper:encode('SetExternal','XNTExp',#'XSetExp'{bool = true, os = "kalle"}),
 
85
    ?line {ok,{'XSetExp',[107,97,108,108,101],true}} = 
 
86
        asn1_wrapper:decode('SetExternal','XNTExp',lists:flatten(Bytes31)),
 
87
 
 
88
    ?line {ok,Bytes32} = 
 
89
        asn1_wrapper:encode('SetExternal','XImpExp',#'XSetExp'{bool = true, os = "kalle"}),
 
90
    ?line {ok,{'XSetExp',[107,97,108,108,101],true}} = 
 
91
        asn1_wrapper:decode('SetExternal','XImpExp',lists:flatten(Bytes32)),
 
92
 
 
93
    ?line {ok,Bytes33} = 
 
94
        asn1_wrapper:encode('SetExternal','XExpExp',#'XSetExp'{bool = true, os = "kalle"}),
 
95
    ?line {ok,{'XSetExp',[107,97,108,108,101],true}} = 
 
96
        asn1_wrapper:decode('SetExternal','XExpExp',lists:flatten(Bytes33)),
 
97
 
 
98
 
 
99
    
 
100
    ?line {ok,Bytes41} = 
 
101
        asn1_wrapper:encode('SetExternal','SetXSeq1',
 
102
                      #'SetXSeq1'{bool = true, 
 
103
                                  int = 66,
 
104
                                  seq = #'XSeq1'{bool1 = true, 
 
105
                                                 int1 = 77,
 
106
                                                 seq1 = #'XSeqIn'{boolIn = false, 
 
107
                                                                  intIn = 88}}}),
 
108
    ?line {ok,{'SetXSeq1',{'XSeq1',true,77,{'XSeqIn',false,88}},true,66}} = 
 
109
        asn1_wrapper:decode('SetExternal','SetXSeq1',lists:flatten(Bytes41)),
 
110
 
 
111
 
 
112
 
 
113
    ?line {ok,Bytes42} = 
 
114
        asn1_wrapper:encode('SetExternal','SetXSeq2',
 
115
                      #'SetXSeq2'{bool = true, 
 
116
                                  int = 66,
 
117
                                  seq = #'XSeq1'{bool1 = true, 
 
118
                                                 int1 = 77,
 
119
                                                 seq1 = #'XSeqIn'{boolIn = false, 
 
120
                                                                  intIn = 88}}}),
 
121
    ?line {ok,{'SetXSeq2',true,{'XSeq1',true,77,{'XSeqIn',false,88}},66}} = 
 
122
        asn1_wrapper:decode('SetExternal','SetXSeq2',lists:flatten(Bytes42)),
 
123
 
 
124
    ?line {ok,Bytes43} = 
 
125
        asn1_wrapper:encode('SetExternal','SetXSeq3',
 
126
                      #'SetXSeq3'{bool = true, 
 
127
                                  int = 66,
 
128
                                  seq = #'XSeq1'{bool1 = true, 
 
129
                                                 int1 = 77,
 
130
                                                 seq1 = #'XSeqIn'{boolIn = false, 
 
131
                                                                  intIn = 88}}}),
 
132
    ?line {ok,{'SetXSeq3',true,66,{'XSeq1',true,77,{'XSeqIn',false,88}}}} = 
 
133
        asn1_wrapper:decode('SetExternal','SetXSeq3',lists:flatten(Bytes43)),
 
134
 
 
135
 
 
136
    
 
137
 
 
138
    ok.
 
139
 
 
140