/*****************************************************************
 ** @author   STF 470
 ** @version  0.0.1
 ** @purpose  1:22.4, Verify behaviour of port.check(catch) with assignment in case of unsuccessful match inside alt
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/
module Sem_2204_the_check_operation_082 {

	signature S() exception(integer);
	type port P procedure {
		inout S;
	}

    type component GeneralComp {
		port P p;
	}

	function f() runs on GeneralComp {
		p.getcall;
		setverdict(pass, "Call received");
		p.raise(S, integer:1);
	}

	testcase TC_Sem_2204_the_check_operation_082() runs on GeneralComp system GeneralComp{
		var GeneralComp v_ptc := GeneralComp.create;
		var integer v_val;
		connect(self:p, v_ptc:p);
		p.call(S:{}, nowait);
		v_ptc.start(f());
        alt
		{
        	[] p.check(catch(S, integer:(100..200)) -> value v_val) {
				setverdict(fail, "Incorrect match");
			}
			[] p.catch {
				if (not isbound(v_val)) {
					setverdict(pass, "As expected, the check operation didn't match");
				}
				else { setverdict(fail, "The v_val variable should still be undefined at this point"); }
			}
		}
    }

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