/*****************************************************************
 ** @author   STF 451, updated by STF 487
 ** @version  0.0.1
 ** @purpose  1:21.3.3, Ensure that self.stop stops current component
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

// The following requirements are tested:
// A component can stop its own behaviour by using a simple stop execution statement
// (see clause 19.9) or by addressing itself in the stop operation, e.g. by using
// the self operation.

module Sem_210303_Stop_test_component_002 {

    type component GeneralComp {
    }
	function f() runs on GeneralComp {
        var boolean v_cond := true;
        if (v_cond) {
            setverdict(pass);
            self.stop; //stops the ptc
        }
        setverdict(fail); // in case the stop operation doesn't work
	}

    testcase TC_Sem_210303_Stop_test_component_002() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc := GeneralComp.create;
		v_ptc.start(f());
		v_ptc.done;
    }

    control {
        execute(TC_Sem_210303_Stop_test_component_002());
    }
}