/***************************************************
 ** @author   STF 433
 ** @version  0.0.1
 ** @purpose  1:22.2.3, Ensure that the IUT correctly handles message trigger operations
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_220203_TriggerOperation_004 {

    type charstring address;

    type port loopbackPort message {
      inout integer
    }


type component GeneralComp {
      port loopbackPort messagePort
}

    const address c_address := "Tester";

testcase TC_Sem_220203_TriggerOperation_004() runs on GeneralComp {
 var address v_sender;
 timer t_timeout:=5.0;


 messagePort.send(2) to c_address;
 t_timeout.start;

    alt {
     [] messagePort.trigger(2) -> sender v_sender {
       messagePort.send(5) to v_sender;
       alt {
        [] messagePort.trigger(5) from v_sender {  //check that correct sender address has been assigned
         setverdict(pass);
        }
        [] messagePort.receive {
         setverdict(fail);
        }
        [] t_timeout.timeout {
         setverdict(fail);
        }
       }
     }
     [] messagePort.trigger {
        setverdict(fail);
     }
     [] t_timeout.timeout {
       setverdict(fail);
     }
    }
}

control{
    execute(TC_Sem_220203_TriggerOperation_004());
}

}
