Last sync 2016.04.01
[deliverable/titan.core.git] / regression_test / XML / XmlWorkflow / src / xmlTest_Functions_complex1.ttcn
CommitLineData
970ed795 1/******************************************************************************
d44e3c4f 2 * Copyright (c) 2000-2016 Ericsson Telecom AB
970ed795
EL
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
d44e3c4f 7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Raduly, Csaba
11 * Szabados, Kristof
12 *
970ed795
EL
13 ******************************************************************************/
14module xmlTest_Functions_complex1
15{
16
17import from www_XmlTest_org_complex1_e all;
18
19external function f_enc_InternationalPrice(in InternationalPrice pdu, out octetstring stream)
20with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
21//0: OK
22//1: NOK
23
24external function f_dec_InternationalPrice(in octetstring stream, out InternationalPrice pdu) return integer
25with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
26
27//Encoding decoding test:
28function f_encDecTest_InternationalPrice() {
29 var InternationalPrice vl_pdu:= {
30 currency:="US",
31 base:=54321.9
32 },vl_decodedPdu;
33 var octetstring vl_expectedEncodedPdu:=char2oct("<InternationalPrice currency='US'>54321.900000</InternationalPrice>\n\n");
34 var octetstring vl_stream:=''O;
35
36 f_enc_InternationalPrice(vl_pdu,vl_stream);
37 if( not match(vl_stream,vl_expectedEncodedPdu)) {
38 log("Expected encoded value: ",vl_expectedEncodedPdu);
39 log("Actual encoded value: ", vl_stream);
40 setverdict(fail);
41 }
42
43 //log("===Checking value decoded from the encoded value vs original value===");
44 if(f_dec_InternationalPrice(vl_stream, vl_decodedPdu)==0) {
45 //log("The decoded pdu: ", vl_decodedPdu);
46 if(match(vl_pdu,vl_decodedPdu)) {
47 setverdict(pass);
48 } else {
49 log("Pdu could not decoded");
50 log(match(vl_pdu,vl_decodedPdu));
51 }
52 }
53
54 //log("===Checking value decoded from the expected value vs original value===");
55 if( f_dec_InternationalPrice(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
56 //log("The decoded pdu: ", vl_decodedPdu);
57 if(match(vl_pdu,vl_decodedPdu)) {
58 setverdict(pass);
59 } else {
60 log("Pdu could not decoded from the expected value");
61 log(match(vl_pdu,vl_decodedPdu));
62 }
63 }
64}
65
66}//module
This page took 0.026475 seconds and 5 git commands to generate.