| 1 | /****************************************************************************** |
| 2 | * Copyright (c) 2000-2016 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 v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * Balasko, Jeno |
| 10 | * Lovassy, Arpad |
| 11 | * Szabo, Janos Zoltan – initial implementation |
| 12 | * |
| 13 | ******************************************************************************/ |
| 14 | // TTCN-3 version of "Hello, world!" |
| 15 | module MyExample |
| 16 | { |
| 17 | type port PCOType message |
| 18 | { |
| 19 | inout charstring; |
| 20 | } |
| 21 | |
| 22 | type component MTCType |
| 23 | { |
| 24 | port PCOType MyPCO; |
| 25 | } |
| 26 | |
| 27 | testcase HelloW() runs on MTCType system MTCType |
| 28 | { |
| 29 | map(mtc:MyPCO, system:MyPCO); |
| 30 | MyPCO.send("Hello, world!"); |
| 31 | setverdict(pass); |
| 32 | } |
| 33 | |
| 34 | testcase HelloW2() runs on MTCType system MTCType |
| 35 | { |
| 36 | timer T := 1.0; |
| 37 | map(mtc:MyPCO, system:MyPCO); |
| 38 | MyPCO.send("Hello, world!"); |
| 39 | T.start; |
| 40 | alt { |
| 41 | [] MyPCO.receive("Hello, TTCN-3!") { T.stop; setverdict(pass); } |
| 42 | [] T.timeout { setverdict(inconc); } |
| 43 | [] MyPCO.receive { T.stop; setverdict(fail); } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | control |
| 48 | { |
| 49 | execute(HelloW()); |
| 50 | execute(HelloW2()); |
| 51 | //1 pass, 1 inconc expected |
| 52 | } |
| 53 | } |