/******************************************************************************
 * Copyright (c) ETSI 2017.
 *
 * This file is subject to copyrights owned by ETSI. Non-exclusive permission
 * is hereby granted, free of charge, to copy, reproduce and amend this file
 * under the following conditions: It is provided "as is", without warranty of any
 * kind, expressed or implied.
 * 
 * ETSI shall never be liable for any claim, damages, or other liability arising
 * from its use or inability of use.This permission does not apply to any documentation
 * associated with this file for which ETSI keeps all rights reserved. The present
 * copyright notice shall be included in all copies of whole or part of this
 * file and shall not imply any sub-license right.
 *
 * Modified by: Adrien Kirjak
 *
 ** @version  0.0.1
 ** @purpose  1:6.2.0.6, ensure that redeclaration of an anytype value works properly
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_060206_anytype_012 {

	type record R
	{
		anytype R1 // R Record type contains an anytype element.
	};

	type component GeneralComp {	    	    

		var anytype Var_1, Var_2,Var_3;
		var R MyRec;

	}
 
	testcase TC_Sem_060206_anytype_012() runs on GeneralComp {

		Var_1.integer := 10; // Var_1 integer with value of 10
		Var_2.float := 3.0E0; 	// Var_2 float with value of 3.0
		MyRec.R1.float := 3.5E0; // record MyRec R1 element is now a float with value of 3.5
	
		Var_3.float := MyRec.R1.float + Var_2.float; // Var_3 is float type = 3.5 + 3.0

		// changing types:	
		Var_1.float := 5.5E0;	// Var_1 float with value of 5.5
		Var_2.charstring := "abc"; 	// Var_2 charstring with value of "abc"
		MyRec.R1.charstring := "def"; // record MyRec R1 element is now a charstring with value of "def" 
	
      	if (match(Var_1.float, 5.5E0) and match(Var_2.charstring, "abc") and match(Var_3.float, 6.5E0) 
          and match(MyRec.R1.charstring, "def")) {
	    	setverdict(pass);
      	}
      	else {
	    	setverdict(fail);
	  	}

	}

	control {
		execute(TC_Sem_060206_anytype_012());
	}

}
with {
	extension "anytype float, integer, charstring"
}
