/******************************************************************************
 * 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.
 *
 * Created by: Adrien Kirjak
 *
 ** @version  0.0.1
 ** @purpose  1:6.3.3, Ensure that the IUT correctly handles component compatibility of mtc and runs on clause
 ** @verdict  pass reject
 ***************************************************/

// The following requirements are tested:
// Mtc compatibility: a function or altstep referring to component type "A" in its mtc clause may be called or
// started in any context that has a mtc clause of type "B" or a testcase with a runs on clause of type "B" if all the
// port definitions of "A" have identical definitions in "B". If the type of the mtc is unknown in the calling
// function, this can lead to runtime errors if the component type "A" is not mtc-compatible with the type of the
// running mtc. 

module Sem_060303_component_types_004 { 

	type port P message {
		inout integer;
	} with {extension "internal"}

	type component GeneralComp {
		port P p1;
		port P p2;
	}
    
    type component GeneralCompEx {
        port P p1;
    }
    
    function f_test() runs on GeneralComp mtc GeneralCompEx {
		setverdict(pass);
    }

	testcase TC_Sem_060303_component_types_004() runs on GeneralComp {
		f_test(); // GeneralCompEx and GeneralComp are mtc compatible
		setverdict(pass);
	}
	
	control{
	    execute(TC_Sem_060303_component_types_004());
	}
}
