// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version 11.1.0
// The generation of user and time information were disabled by the -D flag.

// Copyright (c) 2000-2025 Ericsson Telecom AB

// Do not edit this file unless you know what you are doing.

/* Including header files */

#include "BTS_Tests_perf.hh"

namespace BTS__Tests__perf {

/* Literal string constants */

const unsigned char module_checksum[] = { 0xfa, 0xe9, 0x0b, 0x41, 0x99, 0xb4, 0xc5, 0x75, 0xad, 0xf6, 0x03, 0x0d, 0xd9, 0x1c, 0xcf, 0xce };

/* Global variable definitions */

FLOAT modulepar_mp__wait__time;
const FLOAT& mp__wait__time = modulepar_mp__wait__time;
TTCN_Module module_object("BTS_Tests_perf", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, set_module_param, NULL, log_module_param, NULL, NULL, start_ptc_function, module_control_part);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_11,
  current_runtime_version.requires_minor_version_1,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Bodies of functions, altsteps and testcases */

void f__TC__highchanload__tchh(const CHARSTRING& )
{
TTCN_Location current_location("BTS_Tests_perf.ttcn", 51, TTCN_Location::LOCATION_FUNCTION, "f_TC_highchanload_tchh");
current_location.update_lineno(52);
/* BTS_Tests_perf.ttcn, line 52 */
BTS__Tests::ChannelNrs chan__nr;
chan__nr.set_size(14);
chan__nr[0] = GSM__Types::ts__RslChanNr__Lm(1, 0).valueof();
chan__nr[1] = GSM__Types::ts__RslChanNr__Lm(1, 1).valueof();
chan__nr[2] = GSM__Types::ts__RslChanNr__Lm(2, 0).valueof();
chan__nr[3] = GSM__Types::ts__RslChanNr__Lm(2, 1).valueof();
chan__nr[4] = GSM__Types::ts__RslChanNr__Lm(3, 0).valueof();
chan__nr[5] = GSM__Types::ts__RslChanNr__Lm(3, 1).valueof();
chan__nr[6] = GSM__Types::ts__RslChanNr__Lm(4, 0).valueof();
chan__nr[7] = GSM__Types::ts__RslChanNr__Lm(4, 1).valueof();
chan__nr[8] = GSM__Types::ts__RslChanNr__Lm(5, 0).valueof();
chan__nr[9] = GSM__Types::ts__RslChanNr__Lm(5, 1).valueof();
chan__nr[10] = GSM__Types::ts__RslChanNr__Lm(6, 0).valueof();
chan__nr[11] = GSM__Types::ts__RslChanNr__Lm(6, 1).valueof();
chan__nr[12] = GSM__Types::ts__RslChanNr__Lm(7, 0).valueof();
chan__nr[13] = GSM__Types::ts__RslChanNr__Lm(7, 1).valueof();
current_location.update_lineno(62);
/* BTS_Tests_perf.ttcn, line 62 */
TTCN_Logger::log_str(TTCN_USER, "Started");
{
current_location.update_lineno(63);
/* BTS_Tests_perf.ttcn, line 63 */
INTEGER i(0);
current_location.update_lineno(63);
/* BTS_Tests_perf.ttcn, line 63 */
for ( ; ; ) {
current_location.update_lineno(63);
/* BTS_Tests_perf.ttcn, line 63 */
if (!(i < chan__nr.size_of())) break;
current_location.update_lineno(64);
/* BTS_Tests_perf.ttcn, line 64 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Registering ");
const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i].log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(65);
/* BTS_Tests_perf.ttcn, line 65 */
RSL__Emulation::f__rslem__register(0, const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i], RSL__Emulation::RSL__DchanHdlr_component_RSL__PROC);
current_location.update_lineno(63);
/* BTS_Tests_perf.ttcn, line 63 */
{
INTEGER tmp_0;
++i;
}
}
}
current_location.update_lineno(67);
/* BTS_Tests_perf.ttcn, line 67 */
TTCN_Logger::log_str(TTCN_USER, "Registered");
{
current_location.update_lineno(68);
/* BTS_Tests_perf.ttcn, line 68 */
INTEGER i(0);
current_location.update_lineno(68);
/* BTS_Tests_perf.ttcn, line 68 */
for ( ; ; ) {
current_location.update_lineno(68);
/* BTS_Tests_perf.ttcn, line 68 */
if (!(i < chan__nr.size_of())) break;
current_location.update_lineno(69);
/* BTS_Tests_perf.ttcn, line 69 */
BTS__Tests::f__rsl__transceive(RSL__Types::ts__RSL__CHAN__ACT(GSM__Types::RslChannelNr_template(const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i]), RSL__Types::ts__RSL__ChanMode(RSL__Types::RSL__ChanRateType::RSL__CHRT__TCH__H, RSL__Types::RSL__ChanModeOct6SpeechAlgo::RSL__CMOD__SP__GSM3, RSL__Types::ts__RSL__ChanMode_dtx__downlink_defval), RSL__Types::ts__RSL__CHAN__ACT_at_defval), RSL__Types::tr__RSL__CHAN__ACT__ACK(GSM__Types::RslChannelNr_template(const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i])), (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("RSL CHAN ACT ["),i.log(),TTCN_Logger::log_char(']'),TTCN_Logger::end_event_log2str()), BTS__Tests::f__rsl__transceive_ignore__other_defval);
current_location.update_lineno(68);
/* BTS_Tests_perf.ttcn, line 68 */
{
INTEGER tmp_1;
++i;
}
}
}
current_location.update_lineno(74);
/* BTS_Tests_perf.ttcn, line 74 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Activated, now waiting ");
mp__wait__time.log();
TTCN_Logger::log_event_str(" seconds");
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(76);
/* BTS_Tests_perf.ttcn, line 76 */
Osmocom__Types::f__sleep(mp__wait__time);
current_location.update_lineno(77);
/* BTS_Tests_perf.ttcn, line 77 */
TTCN_Logger::log_str(TTCN_USER, "sleep done, deactivating");
{
current_location.update_lineno(79);
/* BTS_Tests_perf.ttcn, line 79 */
INTEGER i(0);
current_location.update_lineno(79);
/* BTS_Tests_perf.ttcn, line 79 */
for ( ; ; ) {
current_location.update_lineno(79);
/* BTS_Tests_perf.ttcn, line 79 */
if (!(i < chan__nr.size_of())) break;
current_location.update_lineno(80);
/* BTS_Tests_perf.ttcn, line 80 */
BTS__Tests::f__rsl__transceive(RSL__Types::ts__RSL__RF__CHAN__REL(GSM__Types::RslChannelNr_template(const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i])), RSL__Types::tr__RSL__RF__CHAN__REL__ACK(GSM__Types::RslChannelNr_template(const_cast< const BTS__Tests::ChannelNrs&>(chan__nr)[i])), (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("RF CHAN REL ["),i.log(),TTCN_Logger::log_char(']'),TTCN_Logger::end_event_log2str()), TRUE);
current_location.update_lineno(79);
/* BTS_Tests_perf.ttcn, line 79 */
{
INTEGER tmp_2;
++i;
}
}
}
current_location.update_lineno(85);
/* BTS_Tests_perf.ttcn, line 85 */
TTCN_Runtime::setverdict(PASS);
}

void start_f__TC__highchanload__tchh(const COMPONENT& component_reference, const CHARSTRING& id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_highchanload_tchh(");
id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "BTS_Tests_perf", "f_TC_highchanload_tchh", text_buf);
id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

verdicttype testcase_TC__highchanload__tchh(boolean has_timer, double timer_value)
{
TTCN_Runtime::check_begin_testcase(has_timer, timer_value);
TTCN_Location current_location("BTS_Tests_perf.ttcn", 87, TTCN_Location::LOCATION_TESTCASE, "TC_highchanload_tchh");
try {
TTCN_Runtime::begin_testcase("BTS_Tests_perf", "TC_highchanload_tchh", "BTS_Tests", "test_CT", "BTS_Tests", "test_CT", has_timer, timer_value);
current_location.update_lineno(88);
/* BTS_Tests_perf.ttcn, line 88 */
COMPONENT vc__conn;
current_location.update_lineno(89);
/* BTS_Tests_perf.ttcn, line 89 */
BTS__Tests::ConnHdlrPars pars(BTS__Tests::t__Pars(GSM__Types::t__RslChanNr__Bm(INTEGER_template(1)), RSL__Types::ts__RSL__ChanMode__SIGN(RSL__Types::ts__RSL__ChanMode__SIGN_t_defval, RSL__Types::ts__RSL__ChanMode__SIGN_dtxd_defval, RSL__Types::ts__RSL__ChanMode__SIGN_dtxu_defval), BTS__Tests::t__Pars_spec_defval, BTS__Tests::t__Pars_trx__nr_defval, (6.0e1 + mp__wait__time)).valueof());
current_location.update_lineno(92);
/* BTS_Tests_perf.ttcn, line 92 */
BTS__Tests::f__init(BTS__Tests::f__init_trx__nr_defval);
current_location.update_lineno(94);
/* BTS_Tests_perf.ttcn, line 94 */
vc__conn = BTS__Tests::f__start__handler(&f__TC__highchanload__tchh, pars, BTS__Tests::f__start__handler_pcu__comp_defval, BTS__Tests::f__start__handler_trxc__comp_defval, BTS__Tests::f__start__handler_l1ctl_defval);
current_location.update_lineno(95);
/* BTS_Tests_perf.ttcn, line 95 */
{
tmp_4:
alt_status alt_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED;
boolean first_run = TRUE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (alt_flag != ALT_NO) {
alt_flag = vc__conn.done(NULL, NULL);
if (alt_flag == ALT_YES) break;
else if (alt_flag == ALT_REPEAT) goto tmp_4;
}
if (default_flag != ALT_NO) {
default_flag = TTCN_Default::try_altsteps(first_run);
if (default_flag == ALT_YES || default_flag == ALT_BREAK) break;
else if (default_flag == ALT_REPEAT) goto tmp_4;
}
current_location.update_lineno(95);
/* BTS_Tests_perf.ttcn, line 95 */
if (alt_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("Stand-alone done statement failed in file BTS_Tests_perf.ttcn, line 95.");
TTCN_Snapshot::take_new(TRUE);
first_run = FALSE;
}
}
} catch (const TC_Error& tc_error) {
} catch (const TC_End& tc_end) {
TTCN_Logger::log_str(TTCN_FUNCTION, "Test case TC_highchanload_tchh was stopped.");
}
return TTCN_Runtime::end_testcase();
}

void module_control_part()
{
TTCN_Location current_location("BTS_Tests_perf.ttcn", 98, TTCN_Location::LOCATION_CONTROLPART, "BTS_Tests_perf");
TTCN_Runtime::begin_controlpart("BTS_Tests_perf");
TTCN_ControlPartEnder ender_("BTS_Tests_perf");
current_location.update_lineno(99);
/* BTS_Tests_perf.ttcn, line 99 */
testcase_TC__highchanload__tchh(FALSE, 0.0);
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("BTS_Tests_perf.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "BTS_Tests_perf");
BTS__Tests::module_object.pre_init_module();
current_location.update_lineno(40);
/* BTS_Tests_perf.ttcn, line 40 */
modulepar_mp__wait__time = 1.0e1;
module_object.add_modulepar("mp_wait_time");
module_object.add_function("f_TC_highchanload_tchh", (genericfunc_t)&f__TC__highchanload__tchh, (genericfunc_t)&start_f__TC__highchanload__tchh);
module_object.add_testcase_nonpard("TC_highchanload_tchh", testcase_TC__highchanload__tchh);
}

void post_init_module()
{
TTCN_Location current_location("BTS_Tests_perf.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "BTS_Tests_perf");
BTS__Tests::module_object.post_init_module();
}

boolean set_module_param(Module_Param& param)
{
const char* const par_name = param.get_id()->get_current_name();
if (!strcmp(par_name, "mp_wait_time")) {
modulepar_mp__wait__time.set_param(param);
return TRUE;
} else return FALSE;
}

void log_module_param()
{
TTCN_Logger::log_event_str("mp_wait_time := ");
mp__wait__time.log();
}

boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments)
{
if (!strcmp(function_name, "f_TC_highchanload_tchh")) {
CHARSTRING id;
id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_TC_highchanload_tchh(");
id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__TC__highchanload__tchh(id);
TTCN_Runtime::function_finished("f_TC_highchanload_tchh");
return TRUE;
} else return FALSE;
}


} /* end of namespace */
