Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / XML / TTCNandXML / Regressions.ttcnpp
CommitLineData
970ed795 1/******************************************************************************
3abe9331 2 * Copyright (c) 2000-2015 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
7 ******************************************************************************/
8module Regressions {
9modulepar boolean Regressions_verbose := false;
10#define verbose Regressions_verbose
11#include "../macros.ttcnin"
12
13//import from EmbedValues { const LF };
14//import from Flattener { function flatten }
15
16type union choose1 {
17 integer f1,
18 record of boolean f2_list
19}
20with {
21 variant (f2_list) "untagged";
22 variant (f2_list[-]) "name as 'f2' ";
23 variant "element";
24}
25
26DECLARE_EXER_ENCODERS(choose1, cx);
27
28const choose1 alt1 := { f1 := 42 };
29const choose1 alt20:= { f2_list := {} };
30const choose1 alt2 := { f2_list := { true,true,false } };
31
32const universal charstring str_alt1 :=
33"<choose1>\n" &
34"\t<f1>42</f1>\n" &
35"</choose1>\n\n";
36
37const universal charstring str_alt2 :=
38"<choose1>\n" &
39"\t<f2>true</f2>\n" &
40"\t<f2>true</f2>\n" &
41"\t<f2>false</f2>\n" &
42"</choose1>\n\n";
43
44const universal charstring str_alt20 :=
45"<choose1>\n" &
46"</choose1>\n\n";
47
48const universal charstring str_alt21 :=
49"<choose1/>\n\n";
50
51
52type component C {}
53
54testcase tc_enc_choice() runs on C
55{
56 CHECK_METHOD(exer_enc_cx, alt1, str_alt1);
57 CHECK_METHOD(exer_enc_cx, alt2, str_alt2);
58 CHECK_METHOD(exer_enc_cx, alt20,str_alt20);
59}
60
61testcase tc_dec_choice() runs on C
62{
63 CHECK_DECODE(exer_dec_cx, str_alt1, choose1, alt1);
64 CHECK_DECODE(exer_dec_cx, str_alt2, choose1, alt2);
65 CHECK_DECODE(exer_dec_cx, str_alt20, choose1, alt20);
66 CHECK_DECODE(exer_dec_cx, str_alt21, choose1, alt20);
67}
68
69control {
70 execute(tc_enc_choice());
71 execute(tc_dec_choice());
72}
73
74}
75with {
76 encode "XML";
77}
This page took 0.055837 seconds and 5 git commands to generate.