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_list
11 import from www_XmlTest_org_list_e all;
12 //==============================================================================
14 //==============================================================================
15 external function f_enc_StringList(in StringList pdu, out octetstring stream)
16 with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
18 external function f_dec_StringList(in octetstring stream, out StringList pdu) return integer
19 with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
21 //==============================================================================
22 // Encoding decoding test
23 //==============================================================================
24 //==========================================
25 // f_encDecTest_StringList
26 //==========================================
27 function f_encDecTest_StringList() {
28 var StringList vl_pdu:= { "Sue", "Maggie","Lisa", "Peter" }
30 var octetstring vl_expectedEncodedPdu:=char2oct("<StringList>Sue Maggie Lisa Peter</StringList>\n\n");
31 var octetstring vl_stream:=''O;
32 f_enc_StringList(vl_pdu,vl_stream);
34 if( not match(vl_stream,vl_expectedEncodedPdu)) {
35 log("Expected encoded value: ",vl_expectedEncodedPdu);
36 log("Actual encoded value: ", vl_stream);
40 //log("===Checking value decoded from the encoded value vs original value===");
41 var integer vl_retval:=f_dec_StringList(vl_stream, vl_decodedPdu);
42 //log("retval:",vl_retval);
43 if(f_dec_StringList(vl_stream, vl_decodedPdu)==0) {
44 //log("The decoded pdu: ", vl_decodedPdu);
45 if(match(vl_pdu,vl_decodedPdu)) {
48 log("Pdu differs from the expected value");
49 log(match(vl_pdu,vl_decodedPdu));
53 log("Pdu could not decoded");
57 //log("===Checking value decoded from the expected value vs original value===");
58 if( f_dec_StringList(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
59 //log("The decoded pdu: ", vl_decodedPdu);
60 if(match(vl_pdu,vl_decodedPdu)) {
63 log("Pdu could not decoded from the expected value");
64 log(match(vl_pdu,vl_decodedPdu));