| 1 |
/****************************************************************************** |
| 2 |
* Copyright (c) 2000-2021 Ericsson Telecom AB |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Balasko, Jeno |
| 10 |
* Beres, Szabolcs |
| 11 |
* |
| 12 |
******************************************************************************/ |
| 13 |
// TTCN-3 version of "Hello, world!" |
| 14 |
module MyExample0 |
| 15 |
{ |
| 16 |
type port PCOType message |
| 17 |
{ |
| 18 |
inout charstring; |
| 19 |
} |
| 20 |
|
| 21 |
type component MTCType |
| 22 |
{ |
| 23 |
port PCOType MyPCO_PT; |
| 24 |
} |
| 25 |
|
| 26 |
testcase tc_HelloW() runs on MTCType system MTCType |
| 27 |
{ |
| 28 |
map(mtc:MyPCO_PT, system:MyPCO_PT); |
| 29 |
MyPCO_PT.send("Hello, world!"); |
| 30 |
setverdict(pass); |
| 31 |
} |
| 32 |
|
| 33 |
testcase tc_HelloW2() runs on MTCType system MTCType |
| 34 |
{ |
| 35 |
timer TL_T := 15.0; |
| 36 |
map(mtc:MyPCO_PT, system:MyPCO_PT); |
| 37 |
MyPCO_PT.send("Hello, world!"); |
| 38 |
TL_T.start; |
| 39 |
alt { |
| 40 |
[] MyPCO_PT.receive("Hello, TTCN-3!") { TL_T.stop; setverdict(pass); } |
| 41 |
[] TL_T.timeout { setverdict(inconc); } |
| 42 |
[] MyPCO_PT.receive { TL_T.stop; setverdict(fail); } |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
control |
| 47 |
{ |
| 48 |
execute(tc_HelloW()); |
| 49 |
execute(tc_HelloW2()); |
| 50 |
} |
| 51 |
} |