/***************************************************
 ** @author   STF 548
 ** @version  0.0.1
 ** @purpose  1:27.8, Ensure that the IUT correctly handles attribute definitions and their scoping rules
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

// The following requirement is tested:
/* The operation for getting a variant attribute value may be followed by an optional parameter. If no parameter is
present, the operation returns only variants that are not bound to any particular encoding. If the parameter is present, the
returned value will containt variants that are bound to the encoding referenced by the parameter.
 */

 // Restriction a) The optional parameter of the operation shall be used only for getting variant attributes.


module Sem_2708_Retrieving_attribute_values_002 {
   type component GeneralComp {}

// MyPDU1 will be displayed as PDU
	type record MyPDU1 { integer field1 } with {
									display "testDisplayValue";
									encode "Codec1";
									variant "Codec1"."Rule1A";
									variant "Codec1"."Rule1B";
									encode "Codec2";
									variant "Codec2"."Rule2A";
									variant "Codec2"."Rule2B";
									}

	type record	of universal charstring RUC;



testcase TC_Sem_2708_Retrieving_attribute_values_002() runs on GeneralComp {

			var MyPDU1 v_pdu;
			var universal charstring v_display;

			var RUC v_encoding, v_variants;

			v_encoding := v_pdu.encode; // v_encoding will contain { "Codec1", "Codec2" }
			v_variants := v_pdu.variant; // v_variants will contain { "CommonRule" }

  			if (match(v_pdu.encode, { "Codec1", "Codec2" })) {
          		setverdict(pass);
		    } else {
		        setverdict(fail);
		    }
}

control{
    execute(TC_Sem_2708_Retrieving_attribute_values_002());
}

}
