/******************************************************************************
 * 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, Ensure that the IUT correctly handles message receiving operations 
 ** @verdict  pass reject
 *****************************************************************/

module NegSem_220202_ReceiveOperation_001 {
 
signature p_NegSem_220202_ReceiveOperation_001(in integer p_par1, out integer p_par2, inout integer p_par3) return integer;

	template p_NegSem_220202_ReceiveOperation_001 s_baseTemplate := { 
		p_par1 := -,
		p_par2 := 4,
		p_par3 := ?
	}

	template p_NegSem_220202_ReceiveOperation_001 s_returnTemplate modifies s_baseTemplate := { 
		p_par3 := 5
	}

	/*template p_NegSem_220202_ReceiveOperation_001 s_wrongTemplate modifies s_baseTemplate := { 
		p_par3 := 3
	}

	template p_NegSem_220202_ReceiveOperation_001 s_callTemplate := { 
		p_par1 := 1,
		p_par2 := -,
		p_par3 := 3
	}*/

    type port remotePort procedure {
    	out p_NegSem_220202_ReceiveOperation_001;
	} with {extension "internal"}

	type component GeneralComp {	    	    
	  	port remotePort PCO;
	}	

	testcase NegSem_220202_ReceiveOperation_001() runs on GeneralComp {

		PCO.receive(s_returnTemplate);
	
 	/*	PCO.call(p_NegSem_220202_ReceiveOperation_001:s_callTemplate, 5.0) {
			[] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_wrongTemplate value 1) {	 
			//cannot receive from procedure based port	
				setverdict(fail);
			} 
			[] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_returnTemplate value 2) {		
				setverdict(fail);
			} 
			[] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_returnTemplate value 1) {	
				setverdict(pass);
			} 
			[] PCO.catch (timeout) {
				setverdict(fail);
			}
 		}*/
	}

	control{
		execute(NegSem_220202_ReceiveOperation_001());
	}

}
