Commit | Line | Data |
---|---|---|
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 | * | |
970ed795 EL |
12 | ******************************************************************************/ |
13 | module sapc { | |
14 | import from types all; | |
15 | type component sapka {} | |
16 | ||
17 | template CreateSAPCSubscription t_sapc_data := { | |
18 | pcBlacklistService_list := { "a", "b", "c" } | |
19 | } | |
20 | ||
21 | template GetResponseSAPCSubscription g_resp := { | |
22 | permutation( | |
23 | "hello", | |
24 | all from t_sapc_data.pcBlacklistService_list | |
25 | ) | |
26 | }; | |
27 | ||
28 | testcase tc_sapc() runs on sapka | |
29 | { | |
30 | var template CreateSAPCSubscription vt_sapc_data := t_sapc_data | |
31 | ||
32 | // compiler doesn't let us compare templates :( | |
33 | //if (t_sapc_data==vt_sapc_data) { setverdict(pass); } else { setverdict(fail); } | |
34 | if (log2str(t_sapc_data)==log2str(vt_sapc_data)) { setverdict(pass); } else { setverdict(fail); } | |
35 | ||
36 | var template GetResponseSAPCSubscription resp; // initialized from a template | |
37 | var template GetResponseSAPCSubscription resp_vt; // from a var template | |
38 | var template GetResponseSAPCSubscription resp_manual; // hacked by hand | |
39 | ||
40 | if (sizeof (vt_sapc_data.pcBlacklistService_list) > 0) { | |
41 | select (sizeof (vt_sapc_data.pcBlacklistService_list)){ | |
42 | case (1) { | |
43 | resp_manual.pcBlacklistService_list := { | |
44 | permutation("hello", vt_sapc_data.pcBlacklistService_list[0], "goodbye") | |
45 | } | |
46 | } | |
47 | case (2) { | |
48 | resp_manual.pcBlacklistService_list := { | |
49 | permutation ("hello", | |
50 | vt_sapc_data.pcBlacklistService_list[0], | |
51 | vt_sapc_data.pcBlacklistService_list[1], "goodbye") | |
52 | } | |
53 | } | |
54 | case (3) { | |
55 | resp_manual.pcBlacklistService_list := { | |
56 | permutation ("hello", | |
57 | vt_sapc_data.pcBlacklistService_list[0], | |
58 | vt_sapc_data.pcBlacklistService_list[1], | |
59 | vt_sapc_data.pcBlacklistService_list[2], "goodbye") | |
60 | } | |
61 | } | |
62 | case else { | |
63 | resp_manual.pcBlacklistService_list := { | |
64 | permutation ("hello", | |
65 | vt_sapc_data.pcBlacklistService_list[0], | |
66 | vt_sapc_data.pcBlacklistService_list[1], | |
67 | vt_sapc_data.pcBlacklistService_list[2], | |
68 | vt_sapc_data.pcBlacklistService_list[3], "goodbye", | |
69 | *) | |
70 | } | |
71 | } | |
72 | } | |
73 | } | |
74 | ||
75 | // var template referring to a global template | |
76 | resp.pcBlacklistService_list := { | |
77 | permutation( | |
78 | "hello", | |
79 | all from t_sapc_data .pcBlacklistService_list, | |
80 | "goodbye" | |
81 | ) }; | |
82 | ||
83 | // var template referring to another var template | |
84 | resp_vt.pcBlacklistService_list := { | |
85 | permutation( | |
86 | "hello", | |
87 | all from vt_sapc_data .pcBlacklistService_list, | |
88 | "goodbye" | |
89 | ) }; | |
90 | ||
91 | action("manual ", resp_manual.pcBlacklistService_list); | |
92 | action("all ", resp .pcBlacklistService_list); | |
93 | action("all vt ", resp_vt .pcBlacklistService_list); | |
94 | ||
95 | if (log2str(resp.pcBlacklistService_list)==log2str(resp_manual.pcBlacklistService_list)) | |
96 | { setverdict(pass); } else { setverdict(fail, "at line ", __LINE__, "\n", resp.pcBlacklistService_list, " !=\n", resp_manual.pcBlacklistService_list); } | |
97 | ||
98 | if (log2str(resp_vt.pcBlacklistService_list)==log2str(resp_manual.pcBlacklistService_list)) | |
99 | { setverdict(pass); } else { setverdict(fail, "at line ", __LINE__, "\n", resp_vt.pcBlacklistService_list, " !=\n", resp_manual.pcBlacklistService_list); } | |
100 | ||
101 | } // testcase | |
102 | ||
103 | } | |
104 | with { | |
105 | encode "XML" | |
106 | } |