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
11 import from www_XmlTest_org_complex2_e all;
13 external function f_enc_InternationalPrice2(in InternationalPrice2 pdu, out octetstring stream)
14 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
18 external function f_dec_InternationalPrice2(in octetstring stream, out InternationalPrice2 pdu) return integer
19 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
21 external function f_enc_InternationalPrice3(in InternationalPrice3 pdu, out octetstring stream)
22 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
26 external function f_dec_InternationalPrice3(in octetstring stream, out InternationalPrice3 pdu) return integer
27 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
29 external function f_enc_InternationalPrice4(in InternationalPrice4 pdu, out octetstring stream)
30 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
34 external function f_dec_InternationalPrice4(in octetstring stream, out InternationalPrice4 pdu) return integer
35 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
37 //Encoding decoding test:
38 function f_encDecTest_InternationalPrice2() {
39 var InternationalPrice2 vl_pdu:= {
43 var octetstring vl_expectedEncodedPdu:=char2oct("<InternationalPrice2 currency='US' value='54321.900000'/>\n\n");
45 var octetstring vl_stream:=''O;
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);
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)) {
61 log("Pdu could not decoded");
62 log(match(vl_pdu,vl_decodedPdu));
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)) {
72 log("Pdu could not decoded from the expected value");
73 log(match(vl_pdu,vl_decodedPdu));
78 function f_encDecTest_InternationalPrice3() {
79 var InternationalPrice3 vl_pdu:= {
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;
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);
93 //Check value decoded from the encoded vs original value:
94 //log("Decoding comes");
96 if(f_dec_InternationalPrice3(vl_stream, vl_decodedPdu)==0) {
97 //log("The decoded pdu: ", vl_decodedPdu);
98 if(match(vl_pdu,vl_decodedPdu)) {
101 log("Pdu could not decoded");
102 log(match(vl_pdu,vl_decodedPdu));
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)) {
112 log("Pdu could not decoded from the expected value");
113 log(match(vl_pdu,vl_decodedPdu));
119 function f_encDecTest_InternationalPrice4() {
120 var InternationalPrice4 vl_pdu:= {
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;
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);
134 //Check value decoded from the encoded vs original value:
135 //log("Decoding comes");
137 if(f_dec_InternationalPrice4(vl_stream, vl_decodedPdu)==0) {
138 //log("The decoded pdu: ", vl_decodedPdu);
139 if(match(vl_pdu,vl_decodedPdu)) {
142 log("Pdu could not decoded");
143 log(match(vl_pdu,vl_decodedPdu));
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)) {
153 log("Pdu could not decoded from the expected value");
154 log(match(vl_pdu,vl_decodedPdu));