/***************************************************
 ** @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 reject
 ***************************************************/

// The following requirement is tested:
/*  If the attribute can occur multiple times (encode, variant, extension), the operation
returns a record of universal charstring type. If such an attribute is not present, the operation returns an
empty record of value.

Restriction c) An error shall be produced if the Expression in the optional parameters is not one of the valid encode
attributes.
 */

module NegSem_2708_Retrieving_attribute_values_001 {

  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_NegSem_2708_Retrieving_attribute_values_001() runs on GeneralComp {

			var MyPDU1 v_pdu;
			var universal charstring v_display;

			var RUC v_encoding, v_variants;

			v_variants := v_pdu.variant("OtherCodec"); // produces an error as there is no such encode attribute as "OtherCodec"

  			if (match(v_variants, {"OtherCodec"}) ) {
          		setverdict(pass);
		    } else {
		        setverdict(fail);
		    }
}

control{
    execute(TC_NegSem_2708_Retrieving_attribute_values_001());
}

}
