/***************************************************
 ** @author STF 548
 ** @version  0.0.1
 ** @purpose 1:6.5.2, Ensure that union with "set of" containing "implicit omit" handled correctly
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

/*The following requirement is tested:
 * Restriction B: Expansion of record, record of, set, set of, and array values and intermediate fields shall follow
 * the rules of item a) in clauses When using direct assignment notation in a scope where the optional
 * attribute is set to "implicit omit", the uninitialized optional fields in the referenced value, shall
 * implicitly be set to omit after the assignment in the new value, while mandatory fields shall remain unchanged
 */

module Sem_06020501_referencing_fields_of_union_type_012 {

	type set of integer SI;

    type record R {
        SI field1 optional,
        integer field2
    }



	type union MyUnionType
	{
		integer option1,
		R option2
	};

	type component GeneralComp {
	};


	testcase TC_Sem_06020501_referencing_fields_of_union_type_012 () runs on GeneralComp {
		var MyUnionType v_mut;

		var R myRec := {-,1} with { optional "implicit omit" };

		v_mut.option2 := myRec;

		if (match(v_mut.option2, { omit, 1 })) {
			setverdict(pass);
		}
		else {
			setverdict(fail);
		}
	}

	control {
		execute(TC_Sem_06020501_referencing_fields_of_union_type_012());
	}
}