/******************************************************************************
 * Copyright (c) 2000-2025 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
 *
 * Contributors:
 *   Balasko, Jeno
 *   Raduly, Csaba
 *
 ******************************************************************************/
module enum_to_SW {	//^In TTCN-3 module `enum_to_SW'://

type component PDTestComponent {};

/*--- ENUM2INT --------------------------------------------------*/

type enumerated MyFirstEnumType { Monday, Tuesday, Wednesday, Thursday, Friday };
type enumerated MySecondEnumType { Saturday, Sunday, Monday };
type enumerated MyThirdEnumType { first(-3), second (0), third };


testcase enum_to_int() runs on PDTestComponent{ //^In testcase definition//

	const MyFirstEnumType enumvar1_1 := Monday;
	const MyFirstEnumType enumvar1_2 := Wednesday;
	const MyFirstEnumType enumvar1_3 := Friday;

	const MySecondEnumType enumvar2_1 := Monday;
	const MySecondEnumType enumvar2_2 := Saturday;
	const MySecondEnumType enumvar2_3 := Sunday;

	const MyThirdEnumType enumvar3_1 := third;
	const MyThirdEnumType enumvar3_2 := first;
	const MyThirdEnumType enumvar3_3 := second;


	const integer e2ivar1_1 := enum2int(enumvar1_1); 	// returns 0
	const integer e2ivar1_2 := enum2int(enumvar1_2);	// returns 2
	const integer e2ivar1_3 := enum2int(enumvar1_3); 	// returns 4

	const integer e2ivar2_1 := enum2int(enumvar2_1); 	// returns 2
	const integer e2ivar2_2 := enum2int(enumvar2_2); 	// returns 0
	const integer e2ivar2_3 := enum2int(enumvar2_3); 	// returns 1

	const integer e2ivar3_1 := enum2int(enumvar3_1); 	// returns 1
	const integer e2ivar3_2 := enum2int(enumvar3_2); 	// returns -3
	const integer e2ivar3_3 := enum2int(enumvar3_3); 	// returns 0


	if ((e2ivar1_1 == 0)
	and (e2ivar1_1 == enum2int(enumvar1_1)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar1_2 == 2)
	and (e2ivar1_2 == enum2int(enumvar1_2)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar1_3 == 4)
	and (e2ivar1_3 == enum2int(enumvar1_3)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//

	if ((e2ivar2_1 == 2)
	and (e2ivar2_1 == enum2int(enumvar2_1)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar2_2 == 0)
	and (e2ivar2_2 == enum2int(enumvar2_2)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar2_3 == 1)
	and (e2ivar2_3 == enum2int(enumvar2_3)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//

	if ((e2ivar3_1 == 1)
	and (e2ivar3_1 == enum2int(enumvar3_1)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar3_2 == -3)
	and (e2ivar3_2 == enum2int(enumvar3_2)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//
	if ((e2ivar3_3 == 0)
	and (e2ivar3_3 == enum2int(enumvar3_3)))
	     {setverdict(pass);}
	else {setverdict(fail);} //^In else statement// \
	//^warning: Control never reaches this code because of previous effective condition\(s\)//

}

control {
	execute (enum_to_int());
}

}
