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