/***************************************************
 ** @author   STF 409
 ** @version  0.0.1
 ** @purpose  1:6.3.2, Ensure that the IUT correctly handles assignments from structures having compatible types and type ranges
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_060302_structured_types_001 {

	type enumerated EnumeratedType {e_black, e_white};
	type EnumeratedType EnumeratedSynonym;

	type record RecordType {
 	 integer  a(0..10) optional,
 	 integer  b(0..10) optional,
 	 boolean  c
	}
	type record ModifiedRecord {
 	 integer  e 	   optional,
 	 integer  f(0..5)  optional,
 	 boolean  g
	}

	type set SetType {
 	 integer  a(0..10) optional,
 	 integer  b(0..10) optional,
 	 boolean  c
	}
	type set ModifiedSet {
 	 integer  e 	   optional,
 	 integer  f(0..5)  optional,
 	 boolean  g
	}

	type record of integer IntegerList(0..10);
	type record of integer ModifiedList;

	type set of integer IntegerUnorderedList(0..10);
	type set of integer ModifiedUnorderedList;

	type union UnionType {
 	 integer  a(0..10),
 	 EnumeratedType  b,
 	 boolean  c
	}
	type union ModifiedUnion {
 	 integer  a,
 	 boolean  c,
 	 EnumeratedSynonym  b
	}


type component GeneralComp {
}

testcase TC_Sem_060302_structured_types_001() runs on GeneralComp {

    var EnumeratedType v_enum1:=e_black;
    var EnumeratedSynonym v_enum2;
    var ModifiedRecord v_rec1:={f:=4,e:=8,g:=false};
    var RecordType v_rec2;
    var ModifiedSet v_set1:={f:=4,e:=8,g:=false};
    var SetType v_set2;
	var ModifiedList v_list1:={2,4,8};
	var IntegerList v_list2;
 	var ModifiedUnorderedList v_ulist1:={2,4,8};
	var IntegerUnorderedList v_ulist2;
	var ModifiedUnion v_union1:={a:=2};
	var UnionType v_union2;

    v_enum2:=v_enum1;
    v_rec2:=v_rec1;
    v_set2:=v_set1;
    v_list2:=v_list1;
    v_ulist2:=v_ulist1;
    v_union2:=v_union1;

    if (
     (v_enum2==e_black) and
     (v_rec2.a==8 and  v_rec2.b==4 and v_rec2.c==false) and
     (v_set2.a==8 and  v_set2.b==4 and v_set2.c==false) and
     (v_list2[0]==2 and v_list2[1]==4 and v_list2[2]==8) and
     (v_ulist2[0]==2 and v_ulist2[1]==4 and v_ulist2[2]==8) and
     (v_union2.a==2)
    ) {
        setverdict(pass);
    }
    else {
        setverdict(fail);
    }
}

control{
    execute(TC_Sem_060302_structured_types_001());
}

}
