/******************************************************************************
 * 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.2
 ** @purpose  1:21.1.1, Ensure that map param statements are allowed in testcase block
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

module Sem_210101_connect_and_map_operations_009 {

    type component GeneralComp {
        port MyMessagePortType pt_myPort;
    }

    type record MyMessageType1 {
        integer field1,
        charstring field2,
        boolean field3
    }

    type port MyMessagePortType message {
        inout integer;
        map param (in MyMessageType1 p1, inout charstring p2);
    } with {extension "internal"}

    const MyMessageType1 c_myTemplate1 := {
        field1 := 2,
        field2 := "foobar",
        field3 := true
    }

    testcase TC_Sem_210101_connect_and_map_operations_009() runs on GeneralComp system GeneralComp {
        var charstring v_varString := "foobar";

        map(mtc:pt_myPort, system:pt_myPort) param(c_myTemplate1, v_varString);
        
        pt_myPort.send(13);
        log("Map inout parameter: ", v_varString);
        
		if(pt_myPort.checkstate("Mapped")) {
			setverdict(pass);			
		} else {
			setverdict(fail);
		}

        unmap(mtc:pt_myPort, system:pt_myPort);

        setverdict(pass);
    }

    control{
        execute(TC_Sem_210101_connect_and_map_operations_009());
    }
}
