/*****************************************************************
 ** @author   STF 487, updated by STF 572
 ** @version  0.0.2
 ** @purpose  1:20.4, return inside interleave
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

// In the older versions of TTCN-3, stop was not allowed inside interleave.
// The test verifies that this restriction is no longer present in the tested
// tool.

module Sem_2004_InterleaveStatement_012 {

    type port MyPort message {
        inout charstring
    }

    type component GeneralComp {
        port MyPort p;
    }

    function f_interleave() runs on GeneralComp {
        interleave {
            [] p.receive(charstring:"bar") {
                setverdict(pass);
                return;
            }
            [] p.receive(charstring:"foo") {
            }
        }
    }

    testcase TC_Sem_2004_InterleaveStatement_012() runs on GeneralComp {
        p.send(charstring:"foo");
        p.send(charstring:"bar");
        f_interleave();
    }

    control{
        execute(TC_Sem_2004_InterleaveStatement_012());
    }
}