/*****************************************************************
 ** @author   STF 470
 ** @version  0.0.1
 ** @purpose  1:21.3.7, Verify that error occurs when using index redirection in function instance.done operation
 ** @verdict  pass reject
 *****************************************************************/
// The following requirements are tested:
// Restriction d
// The index redirection shall only be used when the operation is used on an any from
// component array construct.
module NegSyn_210307_done_operation_004 {

    type component GeneralComp {}

	function f() runs on GeneralComp {
		timer t := 1.0;
		t.start;
		t.timeout;
	}

	function f_getComp(GeneralComp p_ptc) return GeneralComp {
		return p_ptc;
	}

    testcase TC_NegSyn_210307_done_operation_004() runs on GeneralComp system GeneralComp {
		var integer v_index;
		var GeneralComp v_ptc := GeneralComp.create;
		alt
		{
        	[] any from f_getComp(v_ptc).done -> @index value v_index { setverdict(pass); }
			[else] { setverdict(fail, "The any from done operation didn't find done components"); }
		}
    }

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