/******************************************************************************
 * Copyright (c) ETSI 2017.
 *
 * This file is subject to copyrights owned by ETSI. Non-exclusive permission
 * is hereby granted, free of charge, to copy, reproduce and amend this file
 * under the following conditions: It is provided "as is", without warranty of any
 * kind, expressed or implied.
 * 
 * ETSI shall never be liable for any claim, damages, or other liability arising
 * from its use or inability of use.This permission does not apply to any documentation
 * associated with this file for which ETSI keeps all rights reserved. The present
 * copyright notice shall be included in all copies of whole or part of this
 * file and shall not imply any sub-license right.
 *
 * Modified by: Adrien Kirjak
 *
 ** @version  0.0.1
 ** @purpose  1:22.2.2, verify that a variable of a different but compatible type can be used in a redirect assignment
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

// The following requirements are tested:
// The assignment part in a receiving operation is optional. For message-based ports it is used when it is 
// required to store received messages. In the case of procedure-based ports it is used for storing the in 
// and inout parameters of an accepted call, for storing the return value or for storing exceptions. 
// For the message or parameter value assignment part strong typing is not required, e.g. the variable used 
// for storing a message shall be type-compatible to the type of the incoming message.

module Sem_220202_ReceiveOperation_030 {

	type port P message {
		inout integer;
	} with {extension "internal"}
	
	type integer UInt8 (0..255);

    type component GeneralComp 
	{
		port P p;
	}
	    
    testcase TC_Sem_220202_ReceiveOperation_030() runs on GeneralComp {
        var UInt8 v_int;
		connect(self:p, self:p);

        p.send(10);
        p.receive(integer:?) -> value v_int;

        if (v_int == 10) { setverdict(pass); }
        else { setverdict(fail); }
    }

    control {
        execute(TC_Sem_220202_ReceiveOperation_030(), 5.0);
    }
}
