AnnexB4Template.ttcnpp 2.23 KB
Newer Older
Elemer Lelik's avatar
Elemer Lelik committed
1
/******************************************************************************
Adam Knapp's avatar
Adam Knapp committed
2
 * Copyright (c) 2000-2021 Ericsson Telecom AB
Elemer Lelik's avatar
Elemer Lelik committed
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v2.0
Elemer Lelik's avatar
Elemer Lelik committed
5
 * which accompanies this distribution, and is available at
6
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
Elemer Lelik's avatar
Elemer Lelik committed
7
8
9
10
11
 *
 * Contributors:
 *   Balasko, Jeno
 *   Raduly, Csaba
 *
Elemer Lelik's avatar
Elemer Lelik committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 ******************************************************************************/
module AnnexB4Template {

//import from XSD language "XML" all;
import from AnnexB2 language "XML" all;
import from AnnexB3 language "XML" all;
import from AnnexB4 all;

modulepar boolean AnnexB4Template_verbose := false;
#define verbose   AnnexB4Template_verbose
#include "../macros.ttcnin"

type component ice4 {}

// NewC1 is like AnnexB3.C1 except "name as uncapitalized"
template NewC1 t_NewC1:= {
  a1 :=1,
  a2 :=2,
  base :="-1000"
}

const universal charstring bstr_NewC1 :=
"<NewC1>\n" &
"\t<a1>1</a1>\n" &
"\t<a2>2</a2>\n" &
"\t<base>-1000</base>\n" &
"</NewC1>\n\n";

const universal charstring estr_NewC1 :=
41
"<A:newC1 xmlns:A='urn:nsA' A1='1' A2='2'>-1000</A:newC1>\n\n";
Elemer Lelik's avatar
Elemer Lelik committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

DECLARE_XER_ENCODERS(NewC1, newc1);
DECLARE_EXER_ENCODERS(NewC1, newc1);

testcase encode_newc1() runs on ice4 {
  CHECK_METHOD(bxer_enc_newc1, valueof(t_NewC1), bstr_NewC1);
  CHECK_METHOD(exer_enc_newc1, valueof(t_NewC1), estr_NewC1);
}

///////////////////////////////////////////////////////////////
// NewS1 is like AnnexB2.S1 except "name as uncapitalized"
template NewS1 t_NewS1:=1;

DECLARE_XER_ENCODERS(NewS1, news1)
DECLARE_EXER_ENCODERS(NewS1, news1)

const universal charstring bstr_NewS1 :=
"<NewC1>\n" &
"\t<a1>1</a1>\n" &
"\t<a2>2</a2>\n" &
"\t<base>-1000</base>\n" &
"</NewC1>\n\n";

const universal charstring estr_NewS1 :=
"<NA:newS1 xmlns:NA='nsA'>1</NA:newS1>\n\n"

testcase encode_news1() runs on ice4
{
  CHECK_METHOD(bxer_enc_news1, valueof(t_NewS1), bstr_NewS1);
  CHECK_METHOD(exer_enc_news1, valueof(t_NewS1), estr_NewS1);
}


control {
  execute(encode_newc1());
}

}

/*
<?xml version="1.0" encoding="UTF-8"?>
<NA:newC1 xmlns:NA="nsA" A1=1 A2=2>-1000</NA:newC1>
<?xml version="1.0" encoding="UTF-8"?>
<NA:newS1 xmlns:NA="nsA">1</NA:newS1>
*/