/***************************************************
 ** @author   STF 409
 ** @version  0.0.1
 ** @purpose  1:B.1.2.5, Ensure that the IUT correctly handles template matching of value range definitions
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_B010205_value_range_006 {

	type enumerated EnumeratedType {e_black, e_white, e_green};

	type record RecordType {
 	 integer  a optional,
 	 integer  b optional,
 	 boolean  c
	}

	type union UnionType {
 	 float  a,
 	 EnumeratedType  b,
 	 boolean  c
	}

	type record MessageType {
  	 integer  		field1,
  	 charstring  	field2,
  	 RecordType		field3,
  	 UnionType		field4
	}

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010205_value_range_006() runs on GeneralComp {

    var MessageType v_testMessage;

 template MessageType mw_matchingTemplate:=
 {
  field1 := (0..2),
  field2 := ("a".."f") length (3), //character is out of range because of an empty character
  field3 := {a:=1,b:=(0..2),c:=true},
  field4 := {a:=(1.0 .. 2.0)}
 }

 v_testMessage:=  {
  field1 := 2,
  field2 := "ab",
  field3 := {a:=1,b:=2,c:=true},
  field4 := {a:=1.0}
 }

 messagePort.send(v_testMessage);

    alt {
     [] messagePort.receive(mw_matchingTemplate) {
        setverdict(fail);
     }
     [] messagePort.receive {
        setverdict(pass);
     }
    }
}

control{
    execute(TC_Sem_B010205_value_range_006());
}

}
