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 dualnegtest | |
14 | { | |
15 | import from dual all; | |
16 | ||
17 | // Testing the behavior of erroneous messages with dual-faced ports | |
18 | ||
19 | const ControlRequest c_cr := { "howdy" } | |
20 | with { erroneous (text) "value := omit" } | |
21 | ||
22 | const PDUType1 c_pdu1 := { text := "trunk" } // U.S. version | |
23 | with { erroneous (text) "value := ""car-boot"" " } // British version | |
24 | // Length must be exactly eight to fit FIELDLENGTH(8) | |
25 | ||
26 | const PDUType2 c_pdu2 := { text := "hello" } | |
27 | with { erroneous (text) "value := ""good bye"" " } | |
28 | ||
29 | testcase tc_DUALFACED_erroneous() runs on MTC_CT system SYSTEM_SCT | |
30 | { | |
31 | map(mtc:MTC_PORT, system:SYSTEM_PORT); | |
32 | timer patience := 1.0; | |
33 | ||
34 | patience.start; | |
35 | MTC_PORT.send(c_cr); | |
36 | // simple mapping: PT1_PROVIDER for ControlRequest does not encode the sent value, | |
37 | // so the effect of the erroneous attribute can not be seen. | |
38 | // Because the text in the ControlRequest does not start with a 'C', | |
39 | // the port sends back an ErrorSignal... which is discarded by the incoming mapping. | |
40 | alt { | |
41 | [] MTC_PORT.receive /* anything */ { | |
42 | setverdict(fail, "It wasn't supposed to receive anything yet"); | |
43 | } | |
44 | [else] /* nothing received */ { setverdict(pass); } | |
45 | } | |
46 | patience.stop; | |
47 | ||
48 | patience.start; | |
49 | MTC_PORT.send(c_pdu1); // function(enc_PDUType1_gen), compiler-generated ext func | |
50 | alt { | |
51 | [] MTC_PORT.receive(PDUType2 : { "car-boot" } ) { // erroneous is taken into account | |
52 | setverdict(pass); | |
53 | } | |
54 | [] MTC_PORT.receive /* anything else */ { setverdict(fail, "got unknown response"); } | |
55 | [] patience.timeout { setverdict(fail, "time-out at ", __LINE__); } | |
56 | } | |
57 | patience.stop; | |
58 | ||
59 | patience.start; | |
60 | MTC_PORT.send(c_pdu2); // encode(RAW), built-in encoder function | |
61 | alt { | |
62 | [] MTC_PORT.receive(PDUType2 : { "good bye" } ) { // erroneous is taken into account | |
63 | setverdict(pass); | |
64 | } | |
65 | [] MTC_PORT.receive /* anything else */ { setverdict(fail, "got unknown response"); } | |
66 | [] patience.timeout { setverdict(fail, "time-out at ", __LINE__); } | |
67 | } | |
68 | patience.stop; | |
69 | ||
70 | unmap(mtc:MTC_PORT, system:SYSTEM_PORT); | |
71 | } | |
72 | ||
73 | control { | |
74 | execute(tc_DUALFACED_erroneous()); | |
75 | } | |
76 | ||
77 | } // end of module |