e6fd53899d0da82363887773e7d954b15ea3e06e
[deliverable/titan.core.git] / regression_test / XML / XmlWorkflow / src / xmlTest_Functions_complex2.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8 module xmlTest_Functions_complex2
9 {
10
11 import from www_XmlTest_org_complex2_e all;
12
13 external function f_enc_InternationalPrice2(in InternationalPrice2 pdu, out octetstring stream)
14 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
15 //0: OK
16 //1: NOK
17
18 external function f_dec_InternationalPrice2(in octetstring stream, out InternationalPrice2 pdu) return integer
19 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
20
21 external function f_enc_InternationalPrice3(in InternationalPrice3 pdu, out octetstring stream)
22 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
23 //0: OK
24 //1: NOK
25
26 external function f_dec_InternationalPrice3(in octetstring stream, out InternationalPrice3 pdu) return integer
27 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
28
29 external function f_enc_InternationalPrice4(in InternationalPrice4 pdu, out octetstring stream)
30 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
31 //0: OK
32 //1: NOK
33
34 external function f_dec_InternationalPrice4(in octetstring stream, out InternationalPrice4 pdu) return integer
35 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
36
37 //Encoding decoding test:
38 function f_encDecTest_InternationalPrice2() {
39 var InternationalPrice2 vl_pdu:= {
40 currency:="US",
41 value_:=54321.9
42 },vl_decodedPdu;
43 var octetstring vl_expectedEncodedPdu:=char2oct("<InternationalPrice2 currency='US' value='54321.900000'/>\n\n");
44
45 var octetstring vl_stream:=''O;
46
47 f_enc_InternationalPrice2(vl_pdu,vl_stream);
48 if( not match(vl_stream,vl_expectedEncodedPdu)) {
49 log("Expected encoded value: ",vl_expectedEncodedPdu);
50 log("Actual encoded value: ", vl_stream);
51 setverdict(fail);
52 }
53
54 //Check value decoded from the encoded vs original value:
55 //log("Decoding comes");
56 if(f_dec_InternationalPrice2(vl_stream, vl_decodedPdu)==0) {
57 //log("The decoded pdu: ", vl_decodedPdu);
58 if(match(vl_pdu,vl_decodedPdu)) {
59 setverdict(pass);
60 } else {
61 log("Pdu could not decoded");
62 log(match(vl_pdu,vl_decodedPdu));
63 }
64 }
65
66 //Check value decoded from the expected value vs original value:
67 if( f_dec_InternationalPrice2(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
68 //log("The decoded pdu: ", vl_decodedPdu);
69 if(match(vl_pdu,vl_decodedPdu)) {
70 setverdict(pass);
71 } else {
72 log("Pdu could not decoded from the expected value");
73 log(match(vl_pdu,vl_decodedPdu));
74 }
75 }
76 }
77
78 function f_encDecTest_InternationalPrice3() {
79 var InternationalPrice3 vl_pdu:= {
80 currency:="US",
81 value_:=54321.9
82 },vl_decodedPdu;
83 var octetstring vl_expectedEncodedPdu:=char2oct("<ns42:internationalPrice3 xmlns:ns42='www.XmlTest.org/complex2' currency='US' value='54321.900000'/>\n\n");
84 var octetstring vl_stream:=''O;
85
86 f_enc_InternationalPrice3(vl_pdu,vl_stream);
87 if( not match(vl_stream,vl_expectedEncodedPdu)) {
88 log("Expected encoded value: ",vl_expectedEncodedPdu);
89 log("Actual encoded value: ", vl_stream);
90 setverdict(fail);
91 }
92
93 //Check value decoded from the encoded vs original value:
94 //log("Decoding comes");
95
96 if(f_dec_InternationalPrice3(vl_stream, vl_decodedPdu)==0) {
97 //log("The decoded pdu: ", vl_decodedPdu);
98 if(match(vl_pdu,vl_decodedPdu)) {
99 setverdict(pass);
100 } else {
101 log("Pdu could not decoded");
102 log(match(vl_pdu,vl_decodedPdu));
103 }
104 }
105
106 //Check value decoded from the expected value vs original value:
107 if( f_dec_InternationalPrice3(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
108 //log("The decoded pdu: ", vl_decodedPdu);
109 if(match(vl_pdu,vl_decodedPdu)) {
110 setverdict(pass);
111 } else {
112 log("Pdu could not decoded from the expected value");
113 log(match(vl_pdu,vl_decodedPdu));
114 }
115 }
116 }
117
118
119 function f_encDecTest_InternationalPrice4() {
120 var InternationalPrice4 vl_pdu:= {
121 currency:="US",
122 value_:=54321.9
123 },vl_decodedPdu;
124 var octetstring vl_expectedEncodedPdu:=char2oct("<ns42:internationalPrice4 xmlns:ns42='www.XmlTest.org/complex2' currency='US' value='54321.900000'/>\n\n");
125 var octetstring vl_stream:=''O;
126
127 f_enc_InternationalPrice4(vl_pdu,vl_stream);
128 if( not match(vl_stream,vl_expectedEncodedPdu)) {
129 log("Expected encoded value: ",vl_expectedEncodedPdu);
130 log("Actual encoded value: ", vl_stream);
131 setverdict(fail);
132 }
133
134 //Check value decoded from the encoded vs original value:
135 //log("Decoding comes");
136
137 if(f_dec_InternationalPrice4(vl_stream, vl_decodedPdu)==0) {
138 //log("The decoded pdu: ", vl_decodedPdu);
139 if(match(vl_pdu,vl_decodedPdu)) {
140 setverdict(pass);
141 } else {
142 log("Pdu could not decoded");
143 log(match(vl_pdu,vl_decodedPdu));
144 }
145 }
146
147 //Check value decoded from the expected value vs original value:
148 if( f_dec_InternationalPrice4(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
149 //log("The decoded pdu: ", vl_decodedPdu);
150 if(match(vl_pdu,vl_decodedPdu)) {
151 setverdict(pass);
152 } else {
153 log("Pdu could not decoded from the expected value");
154 log(match(vl_pdu,vl_decodedPdu));
155 }
156 }
157 }
158 }//module
This page took 0.035632 seconds and 4 git commands to generate.