///////////////////////////////////////////////////////////////////////////////
//                                                                           //
// Copyright (c) 2000-2018 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                                 //
///////////////////////////////////////////////////////////////////////////////
module EPTF_Variable_test {

import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Common_Definitions all; // EPTF_IntegerList
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_HashMapOct2Int_Functions all;
import from PIPEasp_PortType all;
import from PIPEasp_Types all;

type component VarTest_CT extends EPTF_Var_CT {
  var integer v_myVar := 1;
  var integer v_myVar2 := 10;
  timer t_wait := 0.5;
  var integer vl_intValue;
  var integer v_myVarIdx;
  var integer vl_intVarIdx;
  var integer vl_intSumIdx;
  var integer vl_remoteIntSubscrIdx;
  var integer vl_remoteIntSubscrIdx2;
  var integer vl_remoteIntRefSubscrIdx;
  var integer vl_remoteRemoteIntRefSubscrIdx;
  port PIPEasp_PT pipe;
}

function f_sumInt(in integer pl_idx, in EPTF_IntegerList pl_argList, in EPTF_IntegerList pl_nonVarArgList, inout EPTF_Var_DirectContent pl_retVal) runs on EPTF_Var_CT {
  var integer vl_sum :=0;
  for (var integer i:=0; i<sizeof(pl_argList); i:=i+1) {
    vl_sum := vl_sum + f_EPTF_Var_getIntValue(pl_argList[i]);
  }
  pl_retVal:= {intVal:=vl_sum};
}

// check if value is even
function f_guard_parity_Int(in integer pl_idx, in EPTF_IntegerList pl_argList, in EPTF_Var_DirectContent pl_newContent) runs on EPTF_Var_CT return boolean {
  var integer vl_value := pl_newContent.intVal;
  return (vl_value rem 2 == 0);
}

function f_postProc_logValue(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on EPTF_Var_CT {
  var EPTF_Var_DirectContent vl_currentContent;
  f_EPTF_Var_getContent(pl_idx, vl_currentContent);
  log("Value of variable ", pl_idx, ": ", vl_currentContent);
}

function f_setverdictFail(in boolean pl_condition, in charstring pl_reason := "") {
  if (pl_condition) {
    setverdict(fail, pl_reason);
  }
}

function f_createConfig1(in EPTF_Var_SubscriptionMode pl_subscriptionMode) runs on VarTest_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",v_myVarIdx);
  
  log("Dereferencing the ref");
//  var integer vl_intValue;
  vl_intValue := f_EPTF_Var_getIntValue(v_myVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  f_setverdictFail((v_myVar!=1)or(v_myVar!=vl_intValue));
  
  log("Modifying value of referenced var to 2...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyIntRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(v_myVarIdx,{intVal:=2});
  vl_intValue := f_EPTF_Var_getIntValue(v_myVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  f_setverdictFail((v_myVar!=2)or(v_myVar!=vl_intValue));
  
  
  log("Creating intVar with initial value: 10");
//  var integer vl_intVarIdx;
  f_EPTF_Var_newInt("intVar",10, vl_intVarIdx);
  f_EPTF_Var_CT_LogAll("----- newInt -------");
  f_EPTF_Var_Log("--intVar--",vl_intVarIdx);
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  f_setverdictFail((vl_intValue!=10));

  log("Modifying value of intVar to 20...");
  f_EPTF_Var_setContent(vl_intVarIdx,{intVal:=20});
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  f_setverdictFail((vl_intValue!=20)or(v_myVar!=2));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  
// SUBSCRIBE local
  // create a variable that contains the sum of the two above:
//  var integer vl_intSumIdx;
  f_EPTF_Var_newInt("intSum",0, vl_intSumIdx);
  f_EPTF_Var_CT_LogAll("----- newInt -------");
  // set its local provider:
  var EPTF_Var_ProviderLocal vl_providerLocal := {calcFn:={
    funcRef := refers(f_sumInt),
    argList := {v_myVarIdx,vl_intVarIdx},
    nonVarArgList := {}
  }};
  f_EPTF_Var_subscribeLocal(vl_intSumIdx,vl_providerLocal);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=22));
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER SET -------");
  
  f_EPTF_Var_addPostProcFn(vl_intSumIdx, {refers(f_postProc_logValue),{}});
  f_EPTF_Var_CT_LogAll("----- POSTPROC SET -------");

  //f_EPTF_Var_callCalcFn(vl_intSumIdx);
  //f_EPTF_Var_Log("--callCalcFn--",vl_intSumIdx);
  
// SUBSCRIBE remote for new EPTF var
  // create remote buffered subscriber for the intSum variable
//  var integer vl_remoteIntSubscrIdx;
  f_EPTF_Var_subscribeRemote(self,"intSum",pl_subscriptionMode, vl_remoteIntSubscrIdx);
  f_EPTF_Var_subscribeRemote(self,"intSum",pl_subscriptionMode, vl_remoteIntSubscrIdx2);// test already subscribed checking with no local name
  f_setverdictFail((vl_remoteIntSubscrIdx!=vl_remoteIntSubscrIdx2));
  f_EPTF_Var_subscribeRemote(self,"intSum",pl_subscriptionMode, vl_remoteIntSubscrIdx2, "remoteInt"); // test already subscribed checking with different local name
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET TIMEOUT -------");
    }
  }
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=22));

// SUBSCRIBE remote for referenced var
  // create remote buffered v_myVar2-referenced subscriber for the intRef variable
  log("v_myVar2: ", v_myVar2);
//  var integer vl_remoteIntRefSubscrIdx;
  f_EPTF_Var_subscribeRemoteIntRef(v_myVar2,self,"myVar",pl_subscriptionMode, vl_remoteIntRefSubscrIdx,"remoteIntRef"); // subscribe-ref with local name
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET FOR REF -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET FOR REF TIMEOUT -------");
    }
  }
  log("v_myVar2: ", v_myVar2);
  f_setverdictFail((v_myVar2!=2));
  
  
  // if this line is not commented out, the subscription after this one will fail in a name clash (name already exist):
  //f_EPTF_Var_newInt("nonBuffered.remoteIntRef",0,vl_remoteRemoteIntRefSubscrIdx);

  // if this line is not commented out, the subscription will fail because the given name does not exist:
  //f_EPTF_Var_subscribeRemote(self,"xxxxx",pl_buffered, vl_remoteRemoteIntRefSubscrIdx);

// SUBSCRIBE remote-remote for referenced var
  // create remote buffered subscriber for the vl_remoteIntRefSubscrIdx variable
//  var integer vl_remoteRemoteIntRefSubscrIdx;
  f_EPTF_Var_subscribeRemote(self,"remoteIntRef",pl_subscriptionMode, vl_remoteRemoteIntRefSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET FOR REF -------");
  
  f_EPTF_Var_addPostProcFn(vl_remoteRemoteIntRefSubscrIdx, {refers(f_postProc_logValue),{}});
  f_EPTF_Var_CT_LogAll("----- POSTPROC SET FOR REMOTE INT REF -------");

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE REMOTE PROVIDER SET FOR REF TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2));
}

testcase tc_EPTF_Var_test_nonBuffered() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("nonBuffered");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);

// REFRESH
  v_myVar := 5;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REFRESH CONTENT TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=5)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=25));

// ADJUST local.REF.param
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL REF TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=26));

// ADJUST local.DIRECT.param
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=36)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote
  f_EPTF_Var_adjustContent(vl_remoteIntRefSubscrIdx,{intVal:=7});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=7)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=37)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=8});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST local.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_intSumIdx,{intVal:=0});

// ADJUST remote.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_remoteIntSubscrIdx,{intVal:=0});


// GUARD FN

  // add guard Fn to myVar
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_addGuardFn(v_myVarIdx,{refers(f_guard_parity_Int),{}});
  f_EPTF_Var_Log("----- GUARDFN SET -------",v_myVarIdx);
  log("v_myVar with guard: ", v_myVar);
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=1});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 1: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=2});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=3});
  f_EPTF_Var_unsubscribe(vl_remoteRemoteIntRefSubscrIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 3: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=4});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 4: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=4)or(v_myVar!=2)or(v_myVar!=v_myVar2)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// END

  f_EPTF_Var_unsubscribe(vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVED -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVE TIMEOUT -------");
    }
  }

  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER REMOVED -------");
  
  f_EPTF_Base_stop(pass);
}

//-------------------------------------------------------------------------------

testcase tc_EPTF_Var_test_Buffered() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_setSyncInterval(0.4);
  f_EPTF_Var_init_CT("Buffered");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(timeLine);

// REFRESH
  v_myVar := 5;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- REFRESH CONTENT -------");
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REFRESH CONTENT TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=5)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=25));

// ADJUST local.REF.param
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL REF TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=26));

// ADJUST local.DIRECT.param
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=36)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote
  f_EPTF_Var_adjustContent(vl_remoteIntRefSubscrIdx,{intVal:=7});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=7)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=37)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=8});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST local.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_intSumIdx,{intVal:=0});

// ADJUST remote.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_remoteIntSubscrIdx,{intVal:=0});


// GUARD FN

  // add guard Fn to myVar
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_addGuardFn(v_myVarIdx,{refers(f_guard_parity_Int),{}});
  f_EPTF_Var_Log("----- GUARDFN SET -------",v_myVarIdx);
  log("v_myVar with guard: ", v_myVar);
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=1});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 1: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=2});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=3});
  f_EPTF_Var_unsubscribe(vl_remoteRemoteIntRefSubscrIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 3: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=4});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 4: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=4)or(v_myVar!=2)or(v_myVar!=v_myVar2)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// END

  f_EPTF_Var_unsubscribe(vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVED -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVE TIMEOUT -------");
    }
  }

  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER REMOVED -------");
  
  f_EPTF_Base_stop(pass);
}

//-------------------------------------------------------------------------------

testcase tc_EPTF_Var_test_BufferedLong() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_setSyncInterval(0.9);
  f_EPTF_Var_init_CT("BufferedLong");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(timeLine);

// REFRESH
  v_myVar := 5;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REFRESH CONTENT TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=5)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=25));

// ADJUST local.REF.param
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL REF TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
// here is out of sync
//  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=26));

// ADJUST local.DIRECT.param
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=36)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote
  f_EPTF_Var_adjustContent(vl_remoteIntRefSubscrIdx,{intVal:=7});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
//out of sync
//  f_setverdictFail((vl_intValue!=7)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=37)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=8});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST local.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_intSumIdx,{intVal:=0});

// ADJUST remote.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_remoteIntSubscrIdx,{intVal:=0});


// GUARD FN

  // add guard Fn to myVar
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_addGuardFn(v_myVarIdx,{refers(f_guard_parity_Int),{}});
  f_EPTF_Var_Log("----- GUARDFN SET -------",v_myVarIdx);
  log("v_myVar with guard: ", v_myVar);
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=1});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 1: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=2});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
// extra wait to sync:
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT WAIT FOR SYNC -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=3});
  f_EPTF_Var_unsubscribe(vl_remoteRemoteIntRefSubscrIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 3: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=4});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 4: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=4)or(v_myVar!=2)or(v_myVar!=v_myVar2)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// END

  f_EPTF_Var_unsubscribe(vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVED -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVE TIMEOUT -------");
    }
  }

  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER REMOVED -------");
  
  f_EPTF_Base_stop(pass);
}

//-------------------------------------------------------------------------------

testcase tc_EPTF_Var_test_Sampled() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_setSyncInterval(0.9);
  f_EPTF_Var_init_CT("BufferedLong");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(sampled);

// REFRESH
  v_myVar := 5;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REFRESH CONTENT TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=5)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=25));

// ADJUST local.REF.param
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL REF TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
// here is out of sync
//  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=26));

// ADJUST local.DIRECT.param
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT LOCAL TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=6)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=36)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote
  f_EPTF_Var_adjustContent(vl_remoteIntRefSubscrIdx,{intVal:=7});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE TIMEOUT -------");
    }
  }
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
//out of sync
//  f_setverdictFail((vl_intValue!=7)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=37)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=8});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// ADJUST local.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_intSumIdx,{intVal:=0});

// ADJUST remote.DIRECT.localProv
// this causes an error:
//  f_EPTF_Var_adjustContent(vl_remoteIntSubscrIdx,{intVal:=0});


// GUARD FN

  // add guard Fn to myVar
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_addGuardFn(v_myVarIdx,{refers(f_guard_parity_Int),{}});
  f_EPTF_Var_Log("----- GUARDFN SET -------",v_myVarIdx);
  log("v_myVar with guard: ", v_myVar);
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=1});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 1: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=8)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=38)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=2});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT -------");
    }
  }
// extra wait to sync:
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 2: ADJUST CONTENT REMOTE REMOTE TIMEOUT WAIT FOR SYNC -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=3});
  f_EPTF_Var_unsubscribe(vl_remoteRemoteIntRefSubscrIdx);
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 3: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=2)or(v_myVar!=v_myVar2)or(v_myVar!=vl_intValue)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));
// ADJUST remote remote
  f_EPTF_Var_adjustContent(vl_remoteRemoteIntRefSubscrIdx,{intVal:=4});
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- GUARDCHECK 4: ADJUST CONTENT AND UNSUBSCRIBE REMOTE REMOTE TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);
  log("v_myVar2: ", v_myVar2);
  vl_intValue := f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx);
  log("getIntValue remoteRemote: ", vl_intValue);
  f_setverdictFail((vl_intValue!=4)or(v_myVar!=2)or(v_myVar!=v_myVar2)or(f_EPTF_Var_getIntValue(vl_remoteIntSubscrIdx)!=32)or(f_EPTF_Var_getIntValue(vl_intVarIdx)!=30));

// END

  f_EPTF_Var_unsubscribe(vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVED -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER REMOVE TIMEOUT -------");
    }
  }

  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER REMOVED -------");
  
  f_EPTF_Base_stop(pass);
}

//-------------------------------------------------------------------------------

testcase tc_EPTF_Var_test_SampledAtSync() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_setSyncInterval(0.9);
  f_EPTF_Var_init_CT("SampledAtSync");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(sampledAtSync);

  f_EPTF_Var_CT_LogAll("----- Sync START -------");
  timer t_wait1 := 1.0;

// SYNC
  v_myVar := 3;  
  // 2 refreshes
  f_EPTF_Var_refreshContent(v_myVarIdx);
  v_myVar := 4;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- Before Sync 4 -------");

  // wait for sync:
  t_wait1.start; t_wait1.timeout;
  f_EPTF_Var_CT_LogAll("----- Sync 4 -------");
  f_setverdictFail((v_myVar!=4)or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteIntRefSubscrIdx))or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx)));

  v_myVar := 5;
  
  // refresh after assignment
  f_EPTF_Var_refreshContent(v_myVarIdx);
  // wait for sync:
  t_wait1.start; t_wait1.timeout;
  f_EPTF_Var_CT_LogAll("----- Sync 5 -------");
  f_setverdictFail((v_myVar!=5)or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteIntRefSubscrIdx))or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx)));

  v_myVar := 1;
  // refresh between 2 assignments
  f_EPTF_Var_refreshContent(v_myVarIdx);
  v_myVar := 6;
  t_wait1.start; t_wait1.timeout;
  f_EPTF_Var_CT_LogAll("----- Sync 6 -------");
  f_setverdictFail((v_myVar!=6)or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteIntRefSubscrIdx))or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx)));
  // refresh before assignment
  f_EPTF_Var_refreshContent(v_myVarIdx);
  v_myVar := 7;
  t_wait1.start; t_wait1.timeout;
  f_EPTF_Var_CT_LogAll("----- Sync 7 -------");
  f_setverdictFail((v_myVar!=7)or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteIntRefSubscrIdx))or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx)));
  // no refresh
  v_myVar := 8;
  t_wait1.start; t_wait1.timeout;
  f_EPTF_Var_CT_LogAll("----- Sync 8 -------");
  f_setverdictFail((v_myVar!=8)or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteIntRefSubscrIdx))or(v_myVar!=f_EPTF_Var_getIntValue(vl_remoteRemoteIntRefSubscrIdx)));
  
  f_EPTF_Base_stop(pass);
}

//-------------------------------------------------------------------------------

type record of VarTest_CT VarTest_CT_List;

function f_EPTF_Var_test1_Behaviour(in charstring pl_selfName, in VarTest_CT_List pl_parents) runs on VarTest_CT {  
  v_myVar := 10;
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT(pl_selfName);
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");
  
  log("Ref assigned to component var");
//  var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",v_myVarIdx);
  
//  var integer vl_remoteIntSubscrIdx;
  f_EPTF_Var_subscribeRemote(pl_parents[0],"myVar",realtime, vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER SET -------");
  
//  var integer vl_intSumIdx;
  f_EPTF_Var_newInt("intSum",0, vl_intSumIdx);
  // set its local provider:
  var EPTF_Var_ProviderLocal vl_providerLocal := {calcFn:={
    funcRef := refers(f_sumInt),
    argList := {v_myVarIdx,vl_remoteIntSubscrIdx},
    nonVarArgList := {}
    
  }};
  f_EPTF_Var_subscribeLocal(vl_intSumIdx,vl_providerLocal);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER SET -------");

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- STARTUP TIMEOUT -------");
    }
  }

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiLD 1-2 TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);

  f_EPTF_Base_cleanup_CT();
}

function f_EPTF_Var_test2_Behaviour(in charstring pl_selfName, in VarTest_CT_List pl_parents) runs on VarTest_CT {  
  v_myVar := 100;
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT(pl_selfName);
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");
  
  log("Ref assigned to component var");
//  var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",v_myVarIdx);
  
  var integer vl_remoteInt0SubscrIdx;
  f_EPTF_Var_subscribeRemote(pl_parents[1],"myVar",realtime, vl_remoteInt0SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER 0 SET -------");
  
  var integer vl_remoteInt1SubscrIdx;
  f_EPTF_Var_subscribeRemote(pl_parents[1],"multiCT.myVar",realtime, vl_remoteInt1SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER 1 SET -------");
  
//  var integer vl_intSumIdx;
  f_EPTF_Var_newInt("intSum",0, vl_intSumIdx);
  // set its local provider:
  var EPTF_Var_ProviderLocal vl_providerLocal := {calcFn:={
    funcRef := refers(f_sumInt),
    argList := {v_myVarIdx,vl_remoteInt0SubscrIdx,vl_remoteInt1SubscrIdx},
    nonVarArgList := {}    
  }};
  f_EPTF_Var_subscribeLocal(vl_intSumIdx,vl_providerLocal);
  f_EPTF_Var_CT_LogAll("----- LOCAL PROVIDER SET -------");

  var integer vl_remoteInt2SubscrIdx;
  f_EPTF_Var_subscribeRemote(pl_parents[0],"myVar",realtime, vl_remoteInt2SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER 2 SET -------");
  
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- STARTUP TIMEOUT -------");
    }
  }

  f_EPTF_Var_adjustContent(vl_remoteInt1SubscrIdx,{intVal:=2});
  f_EPTF_Var_adjustContent(vl_remoteInt0SubscrIdx,{intVal:=20});
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=200});

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiLD 1-2 TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- WAIT TO EXIT TIMEOUT -------");
    }
  }

  // this adjust will generate an error if cleanup is left out from f_EPTF_Var_test1_Behaviour
  f_EPTF_Var_adjustContent(vl_remoteInt2SubscrIdx,{intVal:=3});
  
  f_EPTF_Base_cleanup_CT();
}

function f_EPTF_Var_test3_Behaviour(in charstring pl_selfName, in VarTest_CT_List pl_parents) runs on VarTest_CT {  
  v_myVar := 1000;
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT(pl_selfName);
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  log("Ref assigned to component var");
//  var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",v_myVarIdx);
  
  timer t_getContent := 0.4;
  timer t_endTime := 1.2;
  var EPTF_Var_Ref vl_remotevarRef0 := {pl_parents[0],0};
  var EPTF_Var_Ref vl_remotevarRef1 := {pl_parents[1],0};
  var EPTF_Var_Ref vl_remotevarRef2 := {pl_parents[2],0};
  var EPTF_Var_DirectContent vl_content

  // get an unexistent variable:
  if (f_EPTF_Var_getRemoteContent(pl_parents[1],"xxxx",vl_content)) {
    log("Content is valid: ", vl_content);
  } else {
    log("Content is invalid, remote content is not available");
  }

  // adjust an unexistent variable:
  if (f_EPTF_Var_adjustRemoteContent_Blocking(pl_parents[1],"xxxx",{intVal := 5})) {
    log("Content is valid: ", vl_content);
  } else {
    log("Content is invalid, remote content is not available");
  }

  // get an existent variable with no provider:
  if (f_EPTF_Var_getRemoteContent(pl_parents[0],"myVar",vl_content)) {
    log("Content is valid: ", vl_content);
  } else {
    log("Content is invalid, remote content is not available");
  }

  // adjust an existent variable with no provider:
  if (f_EPTF_Var_adjustRemoteContent_Blocking(pl_parents[0],"myVar",vl_content)) {
    log("Content is valid: ", vl_content);
  } else {
    log("Content is invalid, remote content is not available");
  }
  
  t_getContent.start;
  t_endTime.start;
  alt {
    [] t_getContent.timeout {
      f_EPTF_Var_getRemoteContent(pl_parents[0],"myVar",vl_content);
      f_EPTF_Var_adjustContent(0,vl_content);
      f_EPTF_Var_getRemoteContent(pl_parents[1],"myVar",vl_content);
      f_EPTF_Var_adjustRemoteContent(pl_parents[0],"test3.myVar",vl_content); // adjust the subscriber of my 0-th variable
      f_EPTF_Var_getRemoteContent(pl_parents[2],"myVar",vl_content);

      // adjust a remote variable that cannot be adjusted (subscriber of a calculated variable):
      if (f_EPTF_Var_adjustRemoteContent_Blocking(pl_parents[0],"test1.intSum",vl_content)) { // causes a failed response
        log("Content is valid: ", vl_content);
      } else {
        log("Content is invalid: ", vl_content);
      }
      // adjust a remote variable that cannot be adjusted (calculated variable):
      if (f_EPTF_Var_adjustRemoteContent_Blocking(pl_parents[1],"intSum",vl_content)) { // causes a failed response
        log("Content is valid: ", vl_content);
      } else {
        log("Content is invalid: ", vl_content);
      }
      t_getContent.start;
      repeat;
    }
    [] t_endTime.timeout {
      log("------GetContent Finished----");
    }
  }
  f_EPTF_Base_cleanup_CT();
}  

testcase tc_EPTF_Var_multiCT() runs on VarTest_CT {
  // create 3 components:
  var VarTest_CT vl_VarTest1_CT := VarTest_CT.create;
  var VarTest_CT vl_VarTest2_CT := VarTest_CT.create;
  var VarTest_CT vl_VarTest3_CT := VarTest_CT.create;

  log("v_myVar: ", v_myVar);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("multiCT");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  log("Ref assigned to component var");
//  var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",v_myVarIdx);

  vl_VarTest1_CT.start(f_EPTF_Var_test1_Behaviour("test1",{self}));
  vl_VarTest2_CT.start(f_EPTF_Var_test2_Behaviour("test2",{self,vl_VarTest1_CT}));
  vl_VarTest3_CT.start(f_EPTF_Var_test3_Behaviour("test3",{self,vl_VarTest1_CT,vl_VarTest2_CT}));

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- STARTUP TIMEOUT -------");
    }
  }

  var integer vl_remoteInt1SubscrIdx;
  f_EPTF_Var_subscribeRemote(vl_VarTest1_CT,"intSum",realtime, vl_remoteInt1SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiILD 1 SET -------");

  var integer vl_remoteInt2SubscrIdx;
  f_EPTF_Var_subscribeRemote(vl_VarTest2_CT,"intSum",realtime, vl_remoteInt2SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiILD 2 SET -------");
  
  var integer vl_remoteInt3SubscrIdx;
  f_EPTF_Var_subscribeRemote(vl_VarTest3_CT,"myVar",realtime, vl_remoteInt3SubscrIdx);
  f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiILD 3 SET -------");
  
  // call nonblocking adjust:
  f_EPTF_Var_adjustContent(vl_remoteInt3SubscrIdx,{intVal := 1});
  //call blocking adjust:
  f_EPTF_Var_adjustContent_Blocking(vl_remoteInt3SubscrIdx,{intVal := 2});

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- REMOTE PROVIDER CHiLD 1-2 TIMEOUT -------");
    }
  }
  log("v_myVar: ", v_myVar);

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- WAIT TO EXIT TIMEOUT -------");
    }
  }

  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- WAIT TO EXIT TIMEOUT -------");
    }
  }

  log("v_myVar: ", v_myVar);
  f_EPTF_Base_stop(pass);
}


type component VarTypeCheck_CT extends EPTF_Var_CT {
  timer t_wait := 0.5;

  var integer v_intVar := 1;
  var integer vl_intVarRefIdx;
  var integer vl_intVarIdx;

  var float v_floatVar := 1.0;
  var integer vl_floatVarIdx;
  var integer vl_floatVarRefIdx;

  var boolean v_boolVar := true;
  var integer vl_boolVarIdx;
  var integer vl_boolVarRefIdx;

  var charstring v_charstringVar := "1.0";
  var integer vl_charstringVarIdx;
  var integer vl_charstringVarRefIdx;

  var octetstring v_octetstringVar := '01'O;
  var integer vl_octetstringVarIdx;
  var integer vl_octetstringVarRefIdx;

  var hexstring v_hexstringVar := '01'H;
  var integer vl_hexstringVarIdx;
  var integer vl_hexstringVarRefIdx;

  var bitstring v_bitstringVar := '01'B;
  var integer vl_bitstringVarIdx;
  var integer vl_bitstringVarRefIdx;

  var EPTF_IntegerList v_integerlistVar := {0,1};
  var integer vl_integerlistVarIdx;
  var integer vl_integerlistVarRefIdx;

  var EPTF_FloatList v_floatlistVar := {0.0,1.0};
  var integer vl_floatlistVarIdx;
  var integer vl_floatlistVarRefIdx;

  var EPTF_StatusLED v_statusLEDVar := {led_blue,"1"};
  var integer vl_statusLEDVarIdx;
  var integer vl_statusLEDVarRefIdx;
  //...
}

function f_EPTF_Var_TypeCheckConfig_Int() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newIntRef("intVarRef",v_intVar,vl_intVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newIntRef -------");
  f_EPTF_Var_Log("--var--",vl_intVarRefIdx);
  
  log("Dereferencing the ref");
  var integer vl_intValue;
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarRefIdx);
  log("getIntValue: ", vl_intValue);
  log("v_intVar: ", v_intVar);
  f_setverdictFail((v_intVar!=1)or(v_intVar!=vl_intValue));
  
  log("Modifying value of referenced var to 2...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyIntRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_intVarRefIdx,{intVal:=2});
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarRefIdx);
  log("getIntValue: ", vl_intValue);
  log("v_intVar: ", v_intVar);
  f_setverdictFail((v_intVar!=2)or(v_intVar!=vl_intValue));
  
  
  log("Creating intVar with initial value: 10");
//  var integer vl_intVarIdx;
  f_EPTF_Var_newInt("intVar",10, vl_intVarIdx);
  f_EPTF_Var_CT_LogAll("----- newInt -------");
  f_EPTF_Var_Log("--intVar--",vl_intVarIdx);
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  f_setverdictFail((vl_intValue!=10));

  log("Modifying value of intVar to 20...");
  f_EPTF_Var_setContent(vl_intVarIdx,{intVal:=20});
  vl_intValue := f_EPTF_Var_getIntValue(vl_intVarIdx);
  log("getIntValue: ", vl_intValue);
  log("v_intVar: ", v_intVar);
  f_setverdictFail((vl_intValue!=20)or(v_intVar!=2));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Float() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newFloatRef("floatVarRef", v_floatVar,vl_floatVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newFloatRef -------");
  f_EPTF_Var_Log("--var--",vl_floatVarRefIdx);
  
  log("Dereferencing the ref");
  var float vl_floatValue;
  vl_floatValue := f_EPTF_Var_getFloatValue(vl_floatVarRefIdx);
  log("getFloatValue: ", vl_floatValue);
  log("v_floatVar: ", v_floatVar);
  f_setverdictFail((v_floatVar!=1.0)or(v_floatVar!=vl_floatValue));
  
  log("Modifying value of referenced var to 2...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyFloatRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_floatVarRefIdx,{floatVal:=2.0});
  vl_floatValue := f_EPTF_Var_getFloatValue(vl_floatVarRefIdx);
  log("getFloatValue: ", vl_floatValue);
  log("v_floatVar: ", v_floatVar);
  f_setverdictFail((v_floatVar!=2.0)or(v_floatVar!=vl_floatValue));
  
  
  log("Creating floatVar with initial value: 10.0");
//  var float vl_floatVarIdx;
  f_EPTF_Var_newFloat("floatVar", 10.0, vl_floatVarIdx);
  f_EPTF_Var_CT_LogAll("----- newFloat -------");
  f_EPTF_Var_Log("--floatVar--",vl_floatVarIdx);
  vl_floatValue := f_EPTF_Var_getFloatValue(vl_floatVarIdx);
  log("getFloatValue: ", vl_floatValue);
  f_setverdictFail((vl_floatValue!=10.0));

  log("Modifying value of floatVar to 20.0...");
  f_EPTF_Var_setContent(vl_floatVarIdx,{floatVal:=20.0});
  vl_floatValue := f_EPTF_Var_getFloatValue(vl_floatVarIdx);
  log("getFloatValue: ", vl_floatValue);
  log("v_floatVar: ", v_floatVar);
  f_setverdictFail((vl_floatValue!=20.0)or(v_floatVar!=2.0));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Bool() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newBoolRef("boolVarRef", v_boolVar,vl_boolVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newBoolRef -------");
  f_EPTF_Var_Log("--var--",vl_boolVarRefIdx);
  
  log("Dereferencing the ref");
  var boolean vl_boolValue;
  vl_boolValue := f_EPTF_Var_getBoolValue(vl_boolVarRefIdx);
  log("getBoolValue: ", vl_boolValue);
  log("v_boolVar: ", v_boolVar);
  f_setverdictFail((v_boolVar!=true)or(v_boolVar!=vl_boolValue));
  
  log("Modifying value of referenced var to false...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyBoolRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_boolVarRefIdx,{boolVal:=false});
  vl_boolValue := f_EPTF_Var_getBoolValue(vl_boolVarRefIdx);
  log("getBoolValue: ", vl_boolValue);
  log("v_boolVar: ", v_boolVar);
  f_setverdictFail((v_boolVar!=false)or(v_boolVar!=vl_boolValue));
  
  
  log("Creating boolVar with initial value: true");
//  var bool vl_boolVarIdx;
  f_EPTF_Var_newBool("boolVar", true, vl_boolVarIdx);
  f_EPTF_Var_CT_LogAll("----- newBool -------");
  f_EPTF_Var_Log("--boolVar--",vl_boolVarIdx);
  vl_boolValue := f_EPTF_Var_getBoolValue(vl_boolVarIdx);
  log("getBoolValue: ", vl_boolValue);
  f_setverdictFail((vl_boolValue!=true));

  log("Modifying value of boolVar to false...");
  f_EPTF_Var_setContent(vl_boolVarIdx,{boolVal:=false});
  vl_boolValue := f_EPTF_Var_getBoolValue(vl_boolVarIdx);
  log("getBoolValue: ", vl_boolValue);
  log("v_boolVar: ", v_boolVar);
  f_setverdictFail((vl_boolValue!=false)or(v_boolVar!=false));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Charstring() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newCharstringRef("charstringVarRef", v_charstringVar,vl_charstringVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newCharstringRef -------");
  f_EPTF_Var_Log("--var--",vl_charstringVarRefIdx);
  
  log("Dereferencing the ref");
  var charstring vl_charstringValue;
  vl_charstringValue := f_EPTF_Var_getCharstringValue(vl_charstringVarRefIdx);
  log("getCharstringValue: ", vl_charstringValue);
  log("v_charstringVar: ", v_charstringVar);
  f_setverdictFail((v_charstringVar!="1.0")or(v_charstringVar!=vl_charstringValue));
  
  log("Modifying value of referenced var to 2.0...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyCharstringRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_charstringVarRefIdx,{charstringVal:="2.0"});
  vl_charstringValue := f_EPTF_Var_getCharstringValue(vl_charstringVarRefIdx);
  log("getCharstringValue: ", vl_charstringValue);
  log("v_charstringVar: ", v_charstringVar);
  f_setverdictFail((v_charstringVar!="2.0")or(v_charstringVar!=vl_charstringValue));
  
  
  log("Creating charstringVar with initial value: 10.0");
//  var charstring vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("charstringVar", "10.0", vl_charstringVarIdx);
  f_EPTF_Var_CT_LogAll("----- newCharstring -------");
  f_EPTF_Var_Log("--charstringVar--",vl_charstringVarIdx);
  vl_charstringValue := f_EPTF_Var_getCharstringValue(vl_charstringVarIdx);
  log("getCharstringValue: ", vl_charstringValue);
  f_setverdictFail((vl_charstringValue!="10.0"));

  log("Modifying value of charstringVar to 20.0...");
  f_EPTF_Var_setContent(vl_charstringVarIdx,{charstringVal:="20.0"});
  vl_charstringValue := f_EPTF_Var_getCharstringValue(vl_charstringVarIdx);
  log("getCharstringValue: ", vl_charstringValue);
  log("v_charstringVar: ", v_charstringVar);
  f_setverdictFail((vl_charstringValue!="20.0")or(v_charstringVar!="2.0"));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Octetstring() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newOctetstringRef("octetstringVarRef", v_octetstringVar,vl_octetstringVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newOctetstringRef -------");
  f_EPTF_Var_Log("--var--",vl_octetstringVarRefIdx);
  
  log("Dereferencing the ref");
  var octetstring vl_octetstringValue;
  vl_octetstringValue := f_EPTF_Var_getOctetstringValue(vl_octetstringVarRefIdx);
  log("getOctetstringValue: ", vl_octetstringValue);
  log("v_octetstringVar: ", v_octetstringVar);
  f_setverdictFail((v_octetstringVar!='01'O)or(v_octetstringVar!=vl_octetstringValue));
  
  log("Modifying value of referenced var to 02...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyOctetstringRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_octetstringVarRefIdx,{octetstringVal:='02'O});
  vl_octetstringValue := f_EPTF_Var_getOctetstringValue(vl_octetstringVarRefIdx);
  log("getOctetstringValue: ", vl_octetstringValue);
  log("v_octetstringVar: ", v_octetstringVar);
  f_setverdictFail((v_octetstringVar!='02'O)or(v_octetstringVar!=vl_octetstringValue));
  
  
  log("Creating octetstringVar with initial value: 10");
//  var octetstring vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octetstringVar", '10'O, vl_octetstringVarIdx);
  f_EPTF_Var_CT_LogAll("----- newOctetstring -------");
  f_EPTF_Var_Log("--octetstringVar--",vl_octetstringVarIdx);
  vl_octetstringValue := f_EPTF_Var_getOctetstringValue(vl_octetstringVarIdx);
  log("getOctetstringValue: ", vl_octetstringValue);
  f_setverdictFail((vl_octetstringValue!='10'O));

  log("Modifying value of octetstringVar to 20...");
  f_EPTF_Var_setContent(vl_octetstringVarIdx,{octetstringVal:='20'O});
  vl_octetstringValue := f_EPTF_Var_getOctetstringValue(vl_octetstringVarIdx);
  log("getOctetstringValue: ", vl_octetstringValue);
  log("v_octetstringVar: ", v_octetstringVar);
  f_setverdictFail((vl_octetstringValue!='20'O)or(v_octetstringVar!='02'O));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Hexstring() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newHexstringRef("hexstringVarRef", v_hexstringVar,vl_hexstringVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newHexstringRef -------");
  f_EPTF_Var_Log("--var--",vl_hexstringVarRefIdx);
  
  log("Dereferencing the ref");
  var hexstring vl_hexstringValue;
  vl_hexstringValue := f_EPTF_Var_getHexstringValue(vl_hexstringVarRefIdx);
  log("getHexstringValue: ", vl_hexstringValue);
  log("v_hexstringVar: ", v_hexstringVar);
  f_setverdictFail((v_hexstringVar!='01'H)or(v_hexstringVar!=vl_hexstringValue));
  
  log("Modifying value of referenced var to 2.0...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyHexstringRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_hexstringVarRefIdx,{hexstringVal:='02'H});
  vl_hexstringValue := f_EPTF_Var_getHexstringValue(vl_hexstringVarRefIdx);
  log("getHexstringValue: ", vl_hexstringValue);
  log("v_hexstringVar: ", v_hexstringVar);
  f_setverdictFail((v_hexstringVar!='02'H)or(v_hexstringVar!=vl_hexstringValue));
  
  
  log("Creating hexstringVar with initial value: 10.0");
//  var hexstring vl_hexstringVarIdx;
  f_EPTF_Var_newHexstring("hexstringVar", '10'H, vl_hexstringVarIdx);
  f_EPTF_Var_CT_LogAll("----- newHexstring -------");
  f_EPTF_Var_Log("--hexstringVar--",vl_hexstringVarIdx);
  vl_hexstringValue := f_EPTF_Var_getHexstringValue(vl_hexstringVarIdx);
  log("getHexstringValue: ", vl_hexstringValue);
  f_setverdictFail((vl_hexstringValue!='10'H));

  log("Modifying value of hexstringVar to 20.0...");
  f_EPTF_Var_setContent(vl_hexstringVarIdx,{hexstringVal:='20'H});
  vl_hexstringValue := f_EPTF_Var_getHexstringValue(vl_hexstringVarIdx);
  log("getHexstringValue: ", vl_hexstringValue);
  log("v_hexstringVar: ", v_hexstringVar);
  f_setverdictFail((vl_hexstringValue!='20'H)or(v_hexstringVar!='02'H));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Bitstring() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newBitstringRef("bitstringVarRef", v_bitstringVar,vl_bitstringVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newBitstringRef -------");
  f_EPTF_Var_Log("--var--",vl_bitstringVarRefIdx);
  
  log("Dereferencing the ref");
  var bitstring vl_bitstringValue;
  vl_bitstringValue := f_EPTF_Var_getBitstringValue(vl_bitstringVarRefIdx);
  log("getBitstringValue: ", vl_bitstringValue);
  log("v_bitstringVar: ", v_bitstringVar);
  f_setverdictFail((v_bitstringVar!='01'B)or(v_bitstringVar!=vl_bitstringValue));
  
  log("Modifying value of referenced var to 011...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyBitstringRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_bitstringVarRefIdx,{bitstringVal:='011'B});
  vl_bitstringValue := f_EPTF_Var_getBitstringValue(vl_bitstringVarRefIdx);
  log("getBitstringValue: ", vl_bitstringValue);
  log("v_bitstringVar: ", v_bitstringVar);
  f_setverdictFail((v_bitstringVar!='011'B)or(v_bitstringVar!=vl_bitstringValue));
  
  
  log("Creating bitstringVar with initial value: 10.0");
//  var bitstring vl_bitstringVarIdx;
  f_EPTF_Var_newBitstring("bitstringVar", '10'B, vl_bitstringVarIdx);
  f_EPTF_Var_CT_LogAll("----- newBitstring -------");
  f_EPTF_Var_Log("--bitstringVar--",vl_bitstringVarIdx);
  vl_bitstringValue := f_EPTF_Var_getBitstringValue(vl_bitstringVarIdx);
  log("getBitstringValue: ", vl_bitstringValue);
  f_setverdictFail((vl_bitstringValue!='10'B));

  log("Modifying value of bitstringVar to 110.0...");
  f_EPTF_Var_setContent(vl_bitstringVarIdx,{bitstringVal:='110'B});
  vl_bitstringValue := f_EPTF_Var_getBitstringValue(vl_bitstringVarIdx);
  log("getBitstringValue: ", vl_bitstringValue);
  log("v_bitstringVar: ", v_bitstringVar);
  f_setverdictFail((vl_bitstringValue!='110'B)or(v_bitstringVar!='011'B));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Integerlist() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newIntegerlistRef("integerlistVarRef", v_integerlistVar,vl_integerlistVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newIntegerlistRef -------");
  f_EPTF_Var_Log("--var--",vl_integerlistVarRefIdx);
  
  log("Dereferencing the ref");
  var EPTF_IntegerList vl_integerlistValue;
  vl_integerlistValue := f_EPTF_Var_getIntegerlistValue(vl_integerlistVarRefIdx);
  log("getIntegerlistValue: ", vl_integerlistValue);
  log("v_integerlistVar: ", v_integerlistVar);
  f_setverdictFail((v_integerlistVar!={0,1})or(v_integerlistVar!=vl_integerlistValue));
  
  log("Modifying value of referenced var to 02...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyIntegerlistRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_integerlistVarRefIdx,{integerlistVal:={0,2}});
  vl_integerlistValue := f_EPTF_Var_getIntegerlistValue(vl_integerlistVarRefIdx);
  log("getIntegerlistValue: ", vl_integerlistValue);
  log("v_integerlistVar: ", v_integerlistVar);
  f_setverdictFail((v_integerlistVar!={0,2})or(v_integerlistVar!=vl_integerlistValue));
  
  
  log("Creating integerlistVar with initial value: 10.0");
//  var integerlist vl_integerlistVarIdx;
  f_EPTF_Var_newIntegerlist("integerlistVar", {1,0}, vl_integerlistVarIdx);
  f_EPTF_Var_CT_LogAll("----- newIntegerlist -------");
  f_EPTF_Var_Log("--integerlistVar--",vl_integerlistVarIdx);
  vl_integerlistValue := f_EPTF_Var_getIntegerlistValue(vl_integerlistVarIdx);
  log("getIntegerlistValue: ", vl_integerlistValue);
  f_setverdictFail((vl_integerlistValue!={1,0}));

  log("Modifying value of integerlistVar to 20.0...");
  f_EPTF_Var_setContent(vl_integerlistVarIdx,{integerlistVal:={2,0}});
  vl_integerlistValue := f_EPTF_Var_getIntegerlistValue(vl_integerlistVarIdx);
  log("getIntegerlistValue: ", vl_integerlistValue);
  log("v_integerlistVar: ", v_integerlistVar);
  f_setverdictFail((vl_integerlistValue!={2,0})or(v_integerlistVar!={0,2}));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_Floatlist() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newFloatlistRef("floatlistVarRef", v_floatlistVar,vl_floatlistVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newFloatlistRef -------");
  f_EPTF_Var_Log("--var--",vl_floatlistVarRefIdx);
  
  log("Dereferencing the ref");
  var EPTF_FloatList vl_floatlistValue;
  vl_floatlistValue := f_EPTF_Var_getFloatlistValue(vl_floatlistVarRefIdx);
  log("getFloatlistValue: ", vl_floatlistValue);
  log("v_floatlistVar: ", v_floatlistVar);
  f_setverdictFail((v_floatlistVar!={0.0,1.0})or(v_floatlistVar!=vl_floatlistValue));
  
  log("Modifying value of referenced var to 02...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyIntegerlistRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_floatlistVarRefIdx,{floatlistVal:={0.0,2.0}});
  vl_floatlistValue := f_EPTF_Var_getFloatlistValue(vl_floatlistVarRefIdx);
  log("getFloatlistValue: ", vl_floatlistValue);
  log("v_floatlistVar: ", v_floatlistVar);
  f_setverdictFail((v_floatlistVar!={0.0,2.0})or(v_floatlistVar!=vl_floatlistValue));
  
  
  log("Creating floatlistVar with initial value: 10.0");
//  var integerlist vl_integerlistVarIdx;
  f_EPTF_Var_newFloatlist("floatlistVar", {1.0,0.0}, vl_floatlistVarIdx);
  f_EPTF_Var_CT_LogAll("----- newFloatlist -------");
  f_EPTF_Var_Log("--floatlistVar--",vl_floatlistVarIdx);
  vl_floatlistValue := f_EPTF_Var_getFloatlistValue(vl_floatlistVarIdx);
  log("getFloatlistValue: ", vl_floatlistValue);
  f_setverdictFail((vl_floatlistValue!={1.0,0.0}));

  log("Modifying value of floatlistVar to 20.0...");
  f_EPTF_Var_setContent(vl_floatlistVarIdx,{floatlistVal:={2.0,0.0}});
  vl_floatlistValue := f_EPTF_Var_getFloatlistValue(vl_floatlistVarIdx);
  log("getFloatlistValue: ", vl_floatlistValue);
  log("v_floatlistVar: ", v_floatlistVar);
  f_setverdictFail((vl_floatlistValue!={2.0,0.0})or(v_floatlistVar!={0.0,2.0}));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}

function f_EPTF_Var_TypeCheckConfig_StatusLED() runs on VarTypeCheck_CT {
  log("Ref assigned to component var");
  //var integer v_myVarIdx;
  f_EPTF_Var_newStatusLEDRef("statusLEDVarRef", v_statusLEDVar,vl_statusLEDVarRefIdx);
  f_EPTF_Var_CT_LogAll("----- newStatusLEDRef -------");
  f_EPTF_Var_Log("--var--",vl_statusLEDVarRefIdx);
  
  log("Dereferencing the ref");
  var EPTF_StatusLED vl_statusLEDValue;
  vl_statusLEDValue := f_EPTF_Var_getStatusLEDValue(vl_statusLEDVarRefIdx);
  log("getStatusLEDValue: ", vl_statusLEDValue);
  log("v_statusLEDVar: ", v_statusLEDVar);
  f_setverdictFail((v_statusLEDVar!={led_blue,"1"})or(v_statusLEDVar!=vl_statusLEDValue));
  
  log("Modifying value of referenced var to 02...");
//  var octetstring vl_varRef := f_EPTF_Var_getValueRef(v_myVarIdx);
//  f_EPTF_Var_modifyStatusLEDRefValue(vl_varRef,2);
  f_EPTF_Var_setContent(vl_statusLEDVarRefIdx,{statusLEDVal:={led_black,"2"}});
  vl_statusLEDValue := f_EPTF_Var_getStatusLEDValue(vl_statusLEDVarRefIdx);
  log("getStatusLEDValue: ", vl_statusLEDValue);
  log("v_statusLEDVar: ", v_statusLEDVar);
  f_setverdictFail((v_statusLEDVar!={led_black,"2"})or(v_statusLEDVar!=vl_statusLEDValue));
  
  
  log("Creating statusLEDVar with initial value: 10.0");
//  var statusLED vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_yellow,"10"}, vl_statusLEDVarIdx);
  f_EPTF_Var_CT_LogAll("----- newStatusLED -------");
  f_EPTF_Var_Log("--statusLEDVar--",vl_statusLEDVarIdx);
  vl_statusLEDValue := f_EPTF_Var_getStatusLEDValue(vl_statusLEDVarIdx);
  log("getStatusLEDValue: ", vl_statusLEDValue);
  f_setverdictFail((vl_statusLEDValue!={led_yellow,"10"}));

  log("Modifying value of statusLEDVar to 20.0...");
  f_EPTF_Var_setContent(vl_statusLEDVarIdx,{statusLEDVal:={led_green,"20"}});
  vl_statusLEDValue := f_EPTF_Var_getStatusLEDValue(vl_statusLEDVarIdx);
  log("getStatusLEDValue: ", vl_statusLEDValue);
  log("v_statusLEDVar: ", v_statusLEDVar);
  f_setverdictFail((vl_statusLEDValue!={led_green,"20"})or(v_statusLEDVar!={led_black,"2"}));
  f_EPTF_Var_CT_LogAll("----- END MODIFY -------");
  setverdict(pass);
}
//...

// check if the various EPTF Var types are working perfectly
testcase tc_EPTF_Var_typeCheck() runs on VarTypeCheck_CT {
  f_EPTF_Var_init_CT("typeCheck");
// integer
  f_EPTF_Var_TypeCheckConfig_Int();
  f_EPTF_Var_TypeCheckConfig_Float();
  f_EPTF_Var_TypeCheckConfig_Bool();
  f_EPTF_Var_TypeCheckConfig_Charstring();
  f_EPTF_Var_TypeCheckConfig_Octetstring();
  f_EPTF_Var_TypeCheckConfig_Hexstring();
  f_EPTF_Var_TypeCheckConfig_Bitstring();
  f_EPTF_Var_TypeCheckConfig_Integerlist();
  f_EPTF_Var_TypeCheckConfig_Floatlist();
  f_EPTF_Var_TypeCheckConfig_StatusLED();
  //...

  f_EPTF_Base_cleanup_CT();
}

function f_subsciberBehaviour(in VarTest_CT pl_providerCompRef, in charstring pl_selfName, in charstring pl_parName) runs on VarTest_CT {
  // I am the subscriber:
  f_EPTF_Var_init_CT(pl_selfName);
  
  // subscribe for the given par:
  f_EPTF_Var_subscribeRemote(pl_providerCompRef,pl_parName,timeLine,vl_remoteIntSubscrIdx);
  f_EPTF_Var_CT_LogAll("--Subscribe done--");
  t_wait.start(0.6);
  t_wait.timeout;
  f_EPTF_Base_cleanup_CT();
}

testcase tc_EPTF_Var_BufferedSubsc() runs on VarTest_CT {  
  // I am the provider:
  f_EPTF_Var_init_CT("Provider");

  // create a new parameter:
  f_EPTF_Var_newInt("myVar",1,v_myVarIdx);
  
  // create the subscriber component which subscribes for this var in buffered mode:
  var VarTest_CT v_subscrComp := VarTest_CT.create;
  v_subscrComp.start(f_subsciberBehaviour(self,"Subscriber","myVar"));
  
  t_wait.start;
  t_wait.timeout;
  f_EPTF_Var_CT_LogAll("--Subscribe done--");
  t_wait.start;
  t_wait.timeout;
  f_EPTF_Var_CT_LogAll("--Bye done--");
  f_EPTF_Base_stop(pass);
}

//////////////////////////////////
// AdjustRemoteTest
///////////////////////////////////

type component AdjustRemote_CT extends EPTF_Var_CT {
  var boolean v_AdjustRemote_initialized := false;
}

// mandatory functions for AdjustRemote_CT:
function f_AdjustRemote_init_CT(in charstring pl_selfName /* your additional input parameters */) runs on AdjustRemote_CT {
  if (v_AdjustRemote_initialized) {
    return;
  }

  // call all the init functions of the components that your component extends _explicitly_:
  f_EPTF_Var_init_CT(pl_selfName /*additional parameters*/); 

  // initialize your component variables here...

  v_AdjustRemote_initialized := true;

  // register your cleanup function:
  f_EPTF_Base_registerCleanup(refers(f_AdjustRemote_cleanup_CT));

  log("----AdjustRemote INIT DONE----");
}


function f_AdjustRemote_cleanup_CT() runs on AdjustRemote_CT {
  if (v_AdjustRemote_initialized == false) {
    return;
  }

  // reset your variables here if needed...

  v_AdjustRemote_initialized := false;
  log("----AdjustRemote CLEANUP DONE----");
  // additional cleanup functions can be called here, but better if you do not call them. Register them instead.
}

function f_adjustHandler(in integer pl_idx, in EPTF_Var_DirectContent pl_content,in boolean pl_result, in EPTF_IntegerList pl_argList) runs on AdjustRemote_CT {
  log("Adjust of variable ",pl_idx," to content: ",pl_content, " succeeded: ", pl_result);
  log("Adjust handler args: ", pl_argList);
}

function f_AdjustRemote_Behaviour(in charstring pl_selfName) runs on AdjustRemote_CT {
  f_AdjustRemote_init_CT(pl_selfName);
  
  var EPTF_Var_CT /*AdjustRemote_CT*/ v_selfComp := self;
  
  // create an integer EPTF variable
  var integer vl_intVarIdx;
  f_EPTF_Var_newInt("intVar",0,vl_intVarIdx);
  
  // subscribe for my eptf variable remotely in non-buffered mode, using auto name generation:
  var integer vl_intVarSubscIdx;
  f_EPTF_Var_subscribeRemote(v_selfComp,"intVar",realtime,vl_intVarSubscIdx);
  
  // subscribe for my subscriber eptf variable remotely in buffered mode, using auto name generation:
  var integer vl_intVarSubscBuffIdx;
  f_EPTF_Var_subscribeRemote(v_selfComp,f_EPTF_Base_selfName() & ".intVar",timeLine,vl_intVarSubscBuffIdx);

  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:subscribe done ----");

  // adjust my non-buffered subscriber variable:
  f_EPTF_Var_adjustContent(vl_intVarIdx, {intVal := 1},{refers(f_adjustHandler),{0}});
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:adjustContentWithHandler 0 called ----");

  // adjust remote my non-buffered subscriber variable:
  f_EPTF_Var_adjustRemoteContent_Blocking(v_selfComp,f_EPTF_Base_selfName() & ".intVar", {intVal := 2});
  
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:adjustRemote-nonbuffered done ----");

  // get remote my non-buffered subscribed variable's value:
  var EPTF_Var_DirectContent vl_newValue;
  f_EPTF_Var_getRemoteContent(v_selfComp,f_EPTF_Base_selfName() & ".intVar", vl_newValue);
  
  f_setverdictFail(vl_newValue != {intVal := 2});
  
  // adjust remote my buffered subscriber variable:
  f_EPTF_Var_adjustRemoteContent(v_selfComp,f_EPTF_Base_selfName() & "." & f_EPTF_Base_selfName() & ".intVar", {intVal := 3},{refers(f_adjustHandler),{1}});
  
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:adjustRemote-buffered done ----");

  // get remote my buffered subscribed variable's value:
  f_EPTF_Var_getRemoteContent(v_selfComp,f_EPTF_Base_selfName() & "." & f_EPTF_Base_selfName() & ".intVar", vl_newValue);

  // the value of the buffered subscriber is still the initial value:
  f_setverdictFail(vl_newValue != {intVal := 0});
  // adjust my buffered subscriber variable:
  f_EPTF_Var_adjustContent(vl_intVarSubscBuffIdx, {intVal := 4},{refers(f_adjustHandler),{2}});
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:adjustContentWithHandler 1 called ----");
  f_EPTF_Var_adjustContent(vl_intVarSubscBuffIdx, {intVal := 5},{refers(f_adjustHandler),{3}});
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:adjustContentWithHandler 2 called ----");
  
  // wait for sync message:
  timer t_wait := 10.0;
  t_wait.start;
  alt {
    [] t_wait.timeout {}
  }

  // get my buffered subscribed variable's value:
  f_EPTF_Var_getContent(vl_intVarSubscBuffIdx, vl_newValue);
  
  f_setverdictFail(vl_newValue != {intVal := 5});
  
  f_EPTF_Var_CT_LogAll("---- f_AdjustRemote_Behaviour:DONE ----");
  
  f_EPTF_Base_cleanup_CT();
}

testcase tc_EPTF_Var_AdjustRemote() runs on AdjustRemote_CT {
  
  f_AdjustRemote_Behaviour("All Test");
  setverdict(pass);
}


testcase tc_EPTF_Var_test_noHashmapFunctions() runs on VarTest_CT {

  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("hashmapFunctions");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");
  
  f_EPTF_Var_useCompRef2Id(false);
  f_EPTF_Var_useName2Id(false);

  f_createConfig1(realtime);

  // check variable indexes:
  f_EPTF_Var_CT_LogAll("---- HASHMAP CHECK BEGIN ----");

  // myVar:
  if(v_myVarIdx!=f_EPTF_Var_intCompRef2Id(v_myVar)) {
    f_setverdictFail(true, log2str("Var index incorrect. Index should be: ", v_myVarIdx));
  }
  log("f_EPTF_Var_intCompRef2Id(v_myVar): ",f_EPTF_Var_intCompRef2Id(v_myVar)," done.");
  f_setverdictFail(v_myVarIdx!=f_EPTF_Var_getId("myVar"));
  log("f_EPTF_Var_getId(v_myVar): ",f_EPTF_Var_getId("myVar")," done.");
    
  // intVar:
  f_setverdictFail(vl_intVarIdx!=f_EPTF_Var_getId("intVar"));
  log("f_EPTF_Var_getId(intVar): ",f_EPTF_Var_getId("intVar")," done.");
    
  // intSum:
  f_setverdictFail(vl_intSumIdx!=f_EPTF_Var_getId("intSum"));
  log("f_EPTF_Var_getId(intSum): ",f_EPTF_Var_getId("intSum")," done.");
    
  // f_EPTF_Base_selfName()&"."&"intSum":
  f_setverdictFail(vl_remoteIntSubscrIdx!=f_EPTF_Var_getId(f_EPTF_Base_selfName()&"."&"intSum"));
  log("f_EPTF_Var_getId("&f_EPTF_Base_selfName()&"."&"intSum): ",f_EPTF_Var_getId(f_EPTF_Base_selfName()&"."&"intSum")," done.");
  // remoteInt:
  f_setverdictFail(vl_remoteIntSubscrIdx2!=f_EPTF_Var_getId("remoteInt"));
  log("f_EPTF_Var_getId(remoteInt): ",f_EPTF_Var_getId("remoteInt")," done.");
    
  // remoteIntRef:
  f_setverdictFail(vl_remoteIntRefSubscrIdx!=f_EPTF_Var_intCompRef2Id(v_myVar2));
  log("f_EPTF_Var_intCompRef2Id(v_myVar2): ",f_EPTF_Var_intCompRef2Id(v_myVar2)," done.");
  f_setverdictFail(vl_remoteIntRefSubscrIdx!=f_EPTF_Var_getId("remoteIntRef"));
  log("f_EPTF_Var_getId(remoteIntRef): ",f_EPTF_Var_getId("remoteIntRef")," done.");
    
  // f_EPTF_Base_selfName()&"."&remoteIntRef:
  f_setverdictFail(vl_remoteRemoteIntRefSubscrIdx!=f_EPTF_Var_getId(f_EPTF_Base_selfName()&"."&"remoteIntRef"));
  log("f_EPTF_Var_getId("&f_EPTF_Base_selfName()&"."&"remoteIntRef): ",f_EPTF_Var_getId(f_EPTF_Base_selfName()&"."&"remoteIntRef")," done.");
    
  t_wait.start;
  alt {
    [] t_wait.timeout {
      f_EPTF_Var_CT_LogAll("----- TESTCASE TIMEOUT -------");
    }
  }
  
  f_EPTF_str2int_HashMap_DumpAll();
  log("---str2int DumpAll DONE---");
  f_EPTF_str2int_HashMap_DumpByID(f_EPTF_Var_getHashmap_Name2Id());
  log("---str2int DumpByID DONE---");
  // dump name hashmaps:
  {
  var charstring i;
  var boolean b;
  for(b:=f_EPTF_str2int_HashMap_Begin(f_EPTF_Var_getHashmap_Name2Id(),i);
    b;//not f_EPTF_str2int_HashMap_IsEnd(f_EPTF_Var_getHashmap_Name2Id(),i);
    b:=f_EPTF_str2int_HashMap_Next(f_EPTF_Var_getHashmap_Name2Id(),i)) {
    var integer data;
    f_EPTF_str2int_HashMap_Find(f_EPTF_Var_getHashmap_Name2Id(),i,data);
    log("Hashmap_Name2Id[",i,"]: ", data);
  }
  }

  // dump compRef hashmaps:
  f_EPTF_oct2int_HashMap_DumpAll();
  log("---oct2int DumpAll DONE---");
  f_EPTF_oct2int_HashMap_DumpByID(f_EPTF_Var_getHashmap_Name2Id());
  log("---oct2int DumpByID DONE---");
  {
  var octetstring i;
  var boolean b;
  for(b:=f_EPTF_oct2int_HashMap_Begin(f_EPTF_Var_getHashmap_Hashmap_CompRef2Id(),i);
    b;//not f_EPTF_oct2int_HashMap_IsEnd(f_EPTF_Var_getHashmap_Hashmap_CompRef2Id(),i);
    b:= f_EPTF_oct2int_HashMap_Next(f_EPTF_Var_getHashmap_Hashmap_CompRef2Id(),i)) {
    var integer data;
    f_EPTF_oct2int_HashMap_Find(f_EPTF_Var_getHashmap_Hashmap_CompRef2Id(),i,data);
    log("Hashmap_CompRef2Id[",i,"]: ", data);
  }
  }

  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  
  f_EPTF_Base_stop(pass);
}

//////////////////////////////////////////////////////////////////////
// UNSUBSCRIBE HANDLERS CHECK
//////////////////////////////////////////////////////////////////////

function f_EPTF_Var_test_unsubscribeNotify(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on VarTest_CT {
  log("Variable ", pl_idx, ": ", f_EPTF_Var_getName(pl_idx), " is unsubscribed.");
  f_EPTF_Var_Log("---Unsubscribed var ---", pl_idx);
  v_myVar := v_myVar + 1;
}

testcase tc_EPTF_Var_test_unsubscribeHandlers() runs on VarTest_CT {
  
  f_EPTF_Var_init_CT("unsubscribeHandlers");
  f_createConfig1(realtime);
  f_EPTF_Var_CT_LogAll("---- UNSUBSCRIBEHANDLERS CHECK BEGIN ----");
  
  v_myVar := 0;
  f_EPTF_Var_addUnsubscribeNotifyFn(vl_intSumIdx,{refers(f_EPTF_Var_test_unsubscribeNotify),{}});
  f_EPTF_Var_addUnsubscribeNotifyFn(vl_remoteIntSubscrIdx,{refers(f_EPTF_Var_test_unsubscribeNotify),{}});
  
  f_EPTF_Var_unsubscribe(vl_intSumIdx);
  f_EPTF_Var_unsubscribe(vl_remoteIntSubscrIdx);
  
  t_wait.start; t_wait.timeout;
  
  f_EPTF_Var_removeUnsubscribeNotifyFn(vl_remoteIntSubscrIdx,{refers(f_EPTF_Var_test_unsubscribeNotify),{}});
  f_EPTF_Var_Log("---UnsubscribeNotify fn removed from the variable---",vl_remoteIntSubscrIdx);
  
  f_EPTF_Base_cleanup_CT();
  f_setverdictFail(v_myVar != 2);
  setverdict(pass);
}

/////////////////////////////////////////////
// loadTest
/////////////////////////////////////////////

import from EPTF_CLL_Base_Definitions all;

type record LoadTestMsg {
};

type port LoadTest_PT message {
  inout LoadTestMsg;
} with {extension "internal"}


type component LoadTest_CT extends EPTF_Var_CT {
  var integer vl_intVarIdx;
  timer t_wait;
  timer t_loadGen := 0.01;
  port LoadTest_PT loadTestport;
}

// creates two comp-s and exits
function f_LoadTest_A_Behaviour(in charstring pl_selfName, in LoadTest_CT pl_comp_D) runs on LoadTest_CT {
  f_EPTF_Var_init_CT(pl_selfName);
  var LoadTest_CT v_B_LoadTest_CT := LoadTest_CT.create;
  var LoadTest_CT v_C_LoadTest_CT := LoadTest_CT.create;
  v_B_LoadTest_CT.start(f_LoadTest_B_Behaviour("B",pl_comp_D));
  v_C_LoadTest_CT.start(f_LoadTest_C_Behaviour("C",pl_comp_D));
  
  t_wait.start(0.5); t_wait.timeout;

  // subscribe to the var in C
  var integer vl_intVarSubscIdx;
  f_EPTF_Var_subscribeRemote(v_C_LoadTest_CT,"intVar",realtime,vl_intVarSubscIdx);

  // wait for kill
  t_wait.start(10.0); t_wait.timeout;

  f_EPTF_Base_cleanup_CT();
}

// Kills all comps and exits
function f_LoadTest_B_Behaviour(in charstring pl_selfName, in LoadTest_CT pl_comp_D) runs on LoadTest_CT {
  f_EPTF_Var_init_CT(pl_selfName);

  // wait a bit before subscribe
  t_wait.start(1.0); t_wait.timeout;

  // subscribe to the variable in D
  var integer vl_intVarSubscIdx;
  f_EPTF_Var_subscribeRemote(pl_comp_D,"C.intVar",realtime,vl_intVarSubscIdx);

  // wait a bit before stopping mtc
  t_wait.start(1.0); t_wait.timeout;

  // stop all components including the current one (with pass verdict)
  f_EPTF_Base_stopRemote(mtc);
}

altstep as_Loadest_loadgen() runs on LoadTest_CT {
 [] t_loadGen.timeout {
    t_loadGen.start;
    f_EPTF_Var_adjustContent(vl_intVarIdx,
      { intVal := f_EPTF_Var_getIntValue(vl_intVarIdx) + 1 }
    );
    repeat;
 }
}

// waits for a long time and exits
function f_LoadTest_C_Behaviour(in charstring pl_selfName, in LoadTest_CT pl_comp_D) runs on LoadTest_CT {
  //var default v_def := activate(as_Loadest_loadgen());
  f_EPTF_Var_init_CT(pl_selfName);
  f_EPTF_Var_newInt("intVar",0,vl_intVarIdx);
  connect(self:loadTestport,pl_comp_D:loadTestport);
  loadTestport.send({});
  disconnect(self:loadTestport,pl_comp_D:loadTestport);
  // wait a lot before exiting
  t_wait.start(10.0); 
  t_loadGen.start;
  //t_wait.timeout;
  alt {
   [] t_wait.timeout;
   [] t_loadGen.timeout {
      t_loadGen.start;
      for(var integer i:=0; i<50; i:=i+1) {
        f_EPTF_Var_adjustContent(vl_intVarIdx,
          { intVal := f_EPTF_Var_getIntValue(vl_intVarIdx) + 1 }
        );
      }
      repeat;
   }
  }

  f_EPTF_Base_cleanup_CT();
}

// exits
function f_LoadTest_D_Behaviour(in charstring pl_selfName) runs on LoadTest_CT {
  var LoadTest_CT v_A_LoadTest_CT := LoadTest_CT.create;
  v_A_LoadTest_CT.start(f_LoadTest_A_Behaviour("A",self));
  f_EPTF_Var_init_CT(pl_selfName);

  var LoadTest_CT v_sender;
  loadTestport.receive -> sender v_sender;
  
  // subscribe to the var in C
  var integer vl_intVarSubscIdx;
  f_EPTF_Var_subscribeRemote(v_sender,"intVar",realtime,vl_intVarSubscIdx);

  // wait for kill
  t_wait.start(10.0); t_wait.timeout;
  
  f_EPTF_Base_cleanup_CT();
}

testcase tc_EPTF_Var_test_load() runs on EPTF_Base_CT {
    
  f_EPTF_Base_init_CT("Main");
  var LoadTest_CT v_D_LoadTest_CT := LoadTest_CT.create;
  v_D_LoadTest_CT.start(f_LoadTest_D_Behaviour("D"));
  
  // wait for kill
  timer t_wait;
  t_wait.start(100.0); t_wait.timeout;

  f_EPTF_Base_stop(pass);
}


///////////////////////////////////////////
// timer test
///////////////////////////////////////////

type component TimerTest_CT {
  timer t_minWait := 0.01;
  timer t_maxWait := 10.0;
  timer t_wait := 1.0;
  var boolean blockingFlag := false;
}

altstep as_timer_test_default() runs on TimerTest_CT {
  [] t_maxWait.timeout {
    log("Bloking was not disabled, exiting anyway...");
  }
  [] t_wait.timeout {
    blockingFlag := true;
    log("Blocking disabled.");
    repeat;
  }
}

testcase tc_timer_test() runs on TimerTest_CT {
  t_minWait.start;
  t_maxWait.start;
  t_wait.start;
  log("Waiting......");
  var default v_def := activate(as_timer_test_default());
  
  alt {
    [blockingFlag] t_minWait.timeout {
      log("minWait timeout ok");
      setverdict(pass);
    }
  }
  log("blocking finished");
}

/////////////////////////////////////////
// Resubscribe
/////////////////////////////////////////
testcase tc_EPTF_Var_test_resubscribe() runs on VarTest_CT {
  
  f_EPTF_Var_init_CT("resubscribe");
  
  f_EPTF_Var_newInt("intVar", 1,vl_intVarIdx);
  f_EPTF_Var_newIntRef("myVar",v_myVar,v_myVarIdx);
  
  var integer vl_intVarSubscriberIdx;
  var integer vl_myVarSubscriberIdx;
  var integer vl_myVar2SubscriberIdx;
  
  f_EPTF_Var_subscribeRemote(self,"intVar",realtime, vl_intVarSubscriberIdx);
  f_EPTF_Var_subscribeRemote(self,"myVar",realtime, vl_myVarSubscriberIdx);
  f_EPTF_Var_subscribeRemoteIntRef(v_myVar2,self,"resubscribe.myVar",realtime, vl_myVar2SubscriberIdx);
  
  f_EPTF_Var_CT_LogAll("--------Subscribe done---------");
  
  f_EPTF_Var_unsubscribe(vl_intVarSubscriberIdx);
  f_EPTF_Var_unsubscribe(vl_myVarSubscriberIdx);
  f_EPTF_Var_unsubscribe(vl_myVar2SubscriberIdx);

  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("--------Unsubscribe done---------");

  f_EPTF_Var_resubscribeRemote(self,"intVar",realtime, vl_intVarSubscriberIdx);
  f_EPTF_Var_resubscribeRemote(self,"myVar",realtime, vl_myVarSubscriberIdx);
  f_EPTF_Var_resubscribeRemote(self,"resubscribe.myVar",realtime, vl_myVar2SubscriberIdx,"newName");

  f_EPTF_Var_CT_LogAll("--------Resubscribe done---------");
  
  f_EPTF_Base_stop(pass);
}

/////////////////////////////////////////
// SyncCallback functions
/////////////////////////////////////////

function f_EPTF_Var_syncCallback_begin(in EPTF_IntegerList pl_argList) runs on VarTest_CT {
  log(%definitionId&" start");
  v_myVar := v_myVar + 1;
  f_EPTF_Var_refreshContent(v_myVarIdx);
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_CT_LogAll("--------SyncEvent begin---------");
}

function f_EPTF_Var_syncCallback_end(in EPTF_IntegerList pl_argList) runs on VarTest_CT {
  log(%definitionId&" start");
  log("v_myVar: ", v_myVar);
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal := f_EPTF_Var_getIntValue(vl_intVarIdx) + 10 });
  f_EPTF_Var_CT_LogAll("--------SyncEvent end---------");
}

testcase tc_EPTF_Var_test_syncCallback() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_setSyncInterval(0.4);
  f_EPTF_Var_init_CT("SyncCallback");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);

  v_myVar := 0;
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal := 0 });

  // regiter the syncCallback functions:
  f_EPTF_Var_addSyncCallBackFn(
    refers(f_EPTF_Var_syncCallback_begin),
    {},
    c_EPTF_Var_syncBegin
  );

  f_EPTF_Var_addSyncCallBackFn(
    refers(f_EPTF_Var_syncCallback_end),
    {},
    c_EPTF_Var_syncEnd
  );

  action("----TESTCASE WILL EXIT IN 1.5 seconds...----");
  timer t_exec := 1.5;
  t_exec.start; t_exec.timeout;
  // 4 sync events
  f_setverdictFail((4!=v_myVar));
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=v_myVar+v_myVar*10));

  f_EPTF_Base_stop(pass);

}

/////////////////////////////////////////
// Save/Load
/////////////////////////////////////////
testcase tc_EPTF_Var_test_saveLoad() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("SaveLoad");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);
  
  var integer vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("strVar", "ABC", vl_charstringVarIdx);
  var integer vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octstrVar", 'ABCD'O, vl_octetstringVarIdx);
  
  var integer vl_integerListVarIdx;
  f_EPTF_Var_newIntegerlist("intListVar", {1,2,3}, vl_integerListVarIdx);

  var integer vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_blue, "NONE"}, vl_statusLEDVarIdx);

  var EPTF_Var_InitialValueList vl_initValues := {
    {
      "myVar", {intVal :=5 }
    },
    {
      "intVar", {intVal :=50 }
    },
    {
      "strVar", {charstringVal :="xyz" }
    },
    {
      "octstrVar", {octetstringVal :='1234'O }
    },
    {
      "intListVar", {integerlistVal :={1,2,3} }
    },
    {
      "statusLEDVar", {statusLEDVal :={led_green, "OK"} }
    },
    {
      "ThisVarDoesNotExist", {statusLEDVal :={led_red, "ERROR"} } // just a dummy var that does not loaded and saved
    }
  }
  
  log("vl_initValues: ", vl_initValues);
  
  // load and register vars to save
  for(var integer i:=0; i<sizeof(vl_initValues); i:=i+1) {
    f_EPTF_Var_loadVarFromCfg(vl_initValues[i].name, vl_initValues,false);
    f_EPTF_Var_registerVarToSave(vl_initValues[i].name);
  }
  
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----LOADVARS DONE-----");
  
  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");
  
  // save vars:
  var charstring vl_savedVars := f_EPTF_Var_saveVars(false);
  log("Saved vars: ", vl_savedVars);
  log("Saved vars2tsp: ", f_EPTF_Var_saveVars2tsp("tsp_EPTF_Var_SaveTest_cfg",false));
  
  f_EPTF_Base_cleanup_CT();
}

/////////////////////////////////////////
// Save/Load All
/////////////////////////////////////////
testcase tc_EPTF_Var_test_saveLoadAll() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("SaveLoadAll");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);
  
  var integer vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("strVar", "ABC", vl_charstringVarIdx);
  var integer vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octstrVar", 'ABCD'O, vl_octetstringVarIdx);
  
  var integer vl_integerListVarIdx;
  f_EPTF_Var_newIntegerlist("intListVar", {1,2,3}, vl_integerListVarIdx);

  var integer vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_blue, "NONE"}, vl_statusLEDVarIdx);

  var EPTF_Var_InitialValueList vl_initValues := {
    {
      "myVar", {intVal :=5 }
    },
    {
      "intVar", {intVal :=50 }
    },
    {
      "strVar", {charstringVal :="xyz" }
    },
    {
      "octstrVar", {octetstringVal :='1234'O }
    },
    {
      "intListVar", {integerlistVal :={1,2,3} }
    },
    {
      "statusLEDVar", {statusLEDVal :={led_green, "OK"} }
    },
    {
      "ThisVarDoesNotExist", {statusLEDVal :={led_red, "ERROR"} } // just a dummy var that does not loaded and saved
    }
  }
  
  log("vl_initValues: ", vl_initValues);
  
  // load all:
  f_EPTF_Var_loadVarsFromCfg(vl_initValues, false);
  // register all loaded vars to save
  for(var integer i:=0; i<sizeof(vl_initValues); i:=i+1) {
    f_EPTF_Var_registerVarToSave(vl_initValues[i].name);
  }
  
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----LOADVARS DONE-----");
  
  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");
  
  // save vars:
  var charstring vl_savedVars := f_EPTF_Var_saveVars(false);
  log("Saved vars: ", vl_savedVars);
  log("Saved vars2tsp: ", f_EPTF_Var_saveVars2tsp("tsp_EPTF_Var_SaveTest_cfg",false));
  
  f_EPTF_Base_cleanup_CT();
}

/////////////////////////////////////////
// Save/Load with removeSelfNameFromParamName = true
// The var names in cfg contain selfName, which is removed from the loaded variable name
/////////////////////////////////////////
testcase tc_EPTF_Var_test_saveLoad_with_removeSelfNameFromParamName() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("SaveLoad");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);
  
  var integer vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("strVar", "ABC", vl_charstringVarIdx);
  var integer vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octstrVar", 'ABCD'O, vl_octetstringVarIdx);
  
  var integer vl_integerListVarIdx;
  f_EPTF_Var_newIntegerlist("intListVar", {1,2,3}, vl_integerListVarIdx);

  var integer vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_blue, "NONE"}, vl_statusLEDVarIdx);

  var EPTF_Var_InitialValueList vl_initValues := {
    {
      f_EPTF_Base_selfName()&"."&"myVar", {intVal :=5 }
    },
    {
      f_EPTF_Base_selfName()&"."&"intVar", {intVal :=50 }
    },
    {
      f_EPTF_Base_selfName()&"."&"strVar", {charstringVal :="xyz" }
    },
    {
      f_EPTF_Base_selfName()&"."&"octstrVar", {octetstringVal :='1234'O }
    },
    {
      f_EPTF_Base_selfName()&"."&"intListVar", {integerlistVal :={1,2,3} }
    },
    {
      f_EPTF_Base_selfName()&"."&"statusLEDVar", {statusLEDVal :={led_green, "OK"} }
    },
    {
      "ThisVarDoesNotExist", {statusLEDVal :={led_red, "ERROR"} } // just a dummy var that does not loaded and saved
    }
  }
  
  log("vl_initValues: ", vl_initValues);
  
  // load and register vars to save
  for(var integer i:=0; i<sizeof(vl_initValues); i:=i+1) {
    f_EPTF_Var_loadVarFromCfg(f_EPTF_Var_removeSelfName(vl_initValues[i].name), vl_initValues);
    f_EPTF_Var_registerVarToSave(f_EPTF_Var_removeSelfName(vl_initValues[i].name));
  }
  
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----LOADVARS DONE-----");
  
  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");
  
  // save vars:
  var charstring vl_savedVars := f_EPTF_Var_saveVars();
  log("Saved vars: ", vl_savedVars);
  log("Saved vars2tsp: ", f_EPTF_Var_saveVars2tsp("tsp_EPTF_Var_SaveTest_WithSelfName_cfg"));

  f_EPTF_Base_cleanup_CT();
}

/////////////////////////////////////////
// Save/Load All with removeSelfNameFromParamName = true
// The var names in cfg contain selfName, which is removed from the loaded variable name
/////////////////////////////////////////
testcase tc_EPTF_Var_test_saveLoadAll_with_removeSelfNameFromParamName() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("SaveLoadAll");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);
  
  var integer vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("strVar", "ABC", vl_charstringVarIdx);
  var integer vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octstrVar", 'ABCD'O, vl_octetstringVarIdx);
  
  var integer vl_integerListVarIdx;
  f_EPTF_Var_newIntegerlist("intListVar", {1,2,3}, vl_integerListVarIdx);

  var integer vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_blue, "NONE"}, vl_statusLEDVarIdx);

  var EPTF_Var_InitialValueList vl_initValues := {
    {
      f_EPTF_Base_selfName()&"."&"myVar", {intVal :=5 }
    },
    {
      f_EPTF_Base_selfName()&"."&"intVar", {intVal :=50 }
    },
    {
      f_EPTF_Base_selfName()&"."&"strVar", {charstringVal :="xyz" }
    },
    {
      f_EPTF_Base_selfName()&"."&"octstrVar", {octetstringVal :='1234'O }
    },
    {
      f_EPTF_Base_selfName()&"."&"intListVar", {integerlistVal :={1,2,3} }
    },
    {
      f_EPTF_Base_selfName()&"."&"statusLEDVar", {statusLEDVal :={led_green, "OK"} }
    },
    {
      "ThisVarDoesNotExist", {statusLEDVal :={led_red, "ERROR"} } // just a dummy var that does not loaded and saved
    }
  }
  
  log("vl_initValues: ", vl_initValues);
  
  // load all:
  f_EPTF_Var_loadVarsFromCfg(vl_initValues);
  // register vars to save
  for(var integer i:=0; i<sizeof(vl_initValues); i:=i+1) {
    f_EPTF_Var_registerVarToSave(f_EPTF_Var_removeSelfName(vl_initValues[i].name));
  }
  
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----LOADVARS DONE-----");
  
  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");
  
  // save vars:
  var charstring vl_savedVars := f_EPTF_Var_saveVars();
  log("Saved vars: ", vl_savedVars);
  log("Saved vars2tsp: ", f_EPTF_Var_saveVars2tsp("tsp_EPTF_Var_SaveTest_WithSelfName_cfg"));

  f_EPTF_Base_cleanup_CT();
}

/////////////////////////////////////////
// Save/Load snapshot (with removeSelfNameFromParamName = false)
// The var names in saved file do not contain selfName, they are the same as the variable names
//
// The testcase tests the f_EPTF_Var_save function:
// It compares the saved file with a reference file,
// then loads the data in the reference file to check if data is loaded properly
/////////////////////////////////////////
modulepar EPTF_Var_InitialValueList tsp_EPTF_Var_SaveLoadSnapshot_cfg := {}; // this modulepar is generated
 
altstep as_EPTF_Var_test_saveLoadSnapshot_handlePipe() runs on VarTest_CT {
  [] pipe.receive {
    f_setverdictFail(true, "Unexpected PIPE message received");
    f_EPTF_Base_stopAll();
  }
}


testcase tc_EPTF_Var_test_saveLoadSnapshot() runs on VarTest_CT {
  var default v_def := activate(as_EPTF_Var_test_saveLoadSnapshot_handlePipe());
  map(self:pipe, system:pipe);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("SaveLoadSnapshot");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_createConfig1(realtime);
  
  var integer vl_charstringVarIdx;
  f_EPTF_Var_newCharstring("strVar", "ABC", vl_charstringVarIdx);
  var integer vl_octetstringVarIdx;
  f_EPTF_Var_newOctetstring("octstrVar", 'ABCD'O, vl_octetstringVarIdx);
  
  var integer vl_integerListVarIdx;
  f_EPTF_Var_newIntegerlist("intListVar", {1,2,3}, vl_integerListVarIdx);

  var integer vl_statusLEDVarIdx;
  f_EPTF_Var_newStatusLED("statusLEDVar", {led_blue, "NONE"}, vl_statusLEDVarIdx);

  var EPTF_Var_InitialValueList vl_initValues := {
    {
      f_EPTF_Base_selfName()&"."&"myVar", {intVal :=5 }
    },
    {
      f_EPTF_Base_selfName()&"."&"intVar", {intVal :=50 }
    },
    {
      f_EPTF_Base_selfName()&"."&"strVar", {charstringVal :="xyz" }
    },
    {
      f_EPTF_Base_selfName()&"."&"octstrVar", {octetstringVal :='1234'O }
    },
    {
      f_EPTF_Base_selfName()&"."&"intListVar", {integerlistVal :={1,2,3} }
    },
    {
      f_EPTF_Base_selfName()&"."&"statusLEDVar", {statusLEDVal :={led_green, "OK"} }
    },
    {
      "ThisVarDoesNotExist", {statusLEDVal :={led_red, "ERROR"} } // just a dummy var that does not loaded and saved
    }
  }
  
  log("vl_initValues: ", vl_initValues);
  
  // register vars to save
  for(var integer i:=0; i<sizeof(vl_initValues); i:=i+1) {
    f_EPTF_Var_registerVarToSave(f_EPTF_Var_removeSelfName(vl_initValues[i].name));
  }

  // save vars:
  var charstring vl_savedFile := f_EPTF_Var_save();
  log("Result of save: ", vl_savedFile);
  f_EPTF_Var_CT_LogAll("-----SAVE DONE-----");
  if (vl_savedFile == "") {
    f_setverdictFail(true, "Error occured in saving file");
    f_EPTF_Base_stopAll();
  }
  
  // the saved file should be the same as the reference file
  pipe.send(ASP_PExecute:{
    command := "diff ./EPTF_Var_SnapshotFile.cfg "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{"","",0});

  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");

  // remove the generated file:
  pipe.send(ASP_PExecute:{
    command := "rm "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{"","",0});
  
  // save it again:
  vl_savedFile := f_EPTF_Var_save();
  log("Result of save: ", vl_savedFile);
  f_EPTF_Var_CT_LogAll("-----SAVE DONE-----");
  if (vl_savedFile == "") {
    f_setverdictFail(true, "Error occured in saving file");
    f_EPTF_Base_stopAll();
  }

  // test if it differs from the reference file
  pipe.send(ASP_PExecute:{
    command := "diff ./EPTF_Var_SnapshotFile.cfg "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{complement(""),"",256});

  // now load the values from config:
  log("Loading config from: ", tsp_EPTF_Var_SaveLoadSnapshot_cfg);
  f_EPTF_Var_loadVarsFromCfg(tsp_EPTF_Var_SaveLoadSnapshot_cfg,false);
  // handle the adjusts:
  t_wait.start; t_wait.timeout;

  // remove the generated file:
  pipe.send(ASP_PExecute:{
    command := "rm "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{"","",0});
  
  // save it again:
  vl_savedFile := f_EPTF_Var_save();
  log("Result of save: ", vl_savedFile);
  f_EPTF_Var_CT_LogAll("-----SAVE DONE-----");
  if (vl_savedFile == "") {
    f_setverdictFail(true, "Error occured in saving file");
    f_EPTF_Base_stopAll();
  }

  // test if it is the same as the reference file
  pipe.send(ASP_PExecute:{
    command := "diff ./EPTF_Var_SnapshotFile.cfg "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{"","",0});

  // remove the generated file:
  pipe.send(ASP_PExecute:{
    command := "rm "&vl_savedFile,
    stdin := ""
  });
  pipe.receive(ASP_PResult:{"","",0});
  
/*
  // load from file:
  f_EPTF_Var_load();
  
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----LOAD DONE-----");
  
  // adjust the values:
  f_EPTF_Var_adjustContent(v_myVarIdx,{intVal:=6});
  f_EPTF_Var_adjustContent(vl_intVarIdx,{intVal:=30});
  // handle the adjusts:
  t_wait.start; t_wait.timeout;
  f_EPTF_Var_CT_LogAll("-----ADJUST DONE-----");
  
  // save vars:
  vl_result := f_EPTF_Var_save();
  log("Result of save: ", vl_result);
  f_EPTF_Var_CT_LogAll("-----SAVE DONE-----");
*/
  f_EPTF_Base_cleanup_CT();
}

testcase tc_EPTF_Var_test_isPresentRemote() runs on VarTest_CT {
  var default v_def := activate(as_EPTF_Var_test_saveLoadSnapshot_handlePipe());
  map(self:pipe, system:pipe);
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("IsPresentRemote");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");
  
  // there are no vars currently
  if (f_EPTF_Var_isPresentRemote(self,"myVar")) {
    f_EPTF_Base_stopAll();
  };
  
  f_createConfig1(realtime);
  
  // this should be present
  if (not f_EPTF_Var_isPresentRemote(self,"myVar")) {
    f_EPTF_Base_stopAll();
  };
  
  // this should not be present
  if (f_EPTF_Var_isPresentRemote(self,"XXXXX")) {
    f_EPTF_Base_stopAll();
  };

  f_EPTF_Base_cleanup_CT();
  setverdict(pass);
}

testcase tc_EPTF_Var_test_addLocalProviders() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("addLocalProviders");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");

  f_EPTF_Var_enableDebug();
    
  vl_intVarIdx := -1;
  vl_intSumIdx := -1;
  var EPTF_IntegerList vl_varIdList := {};
  
  f_EPTF_Var_newInt("intVar",1, vl_intVarIdx);
  f_EPTF_Var_newInt("intVar1",10, vl_varIdList[0]);
  f_EPTF_Var_newInt("intVar2",100, vl_varIdList[1]);
  f_EPTF_Var_newInt("intVar3",1000, vl_varIdList[2]);
  
  f_EPTF_Var_newInt("sum",0, vl_intSumIdx);
  var EPTF_Var_ProviderLocal vl_providerLocal := {calcFn:={
    funcRef := refers(f_sumInt),
    argList := {vl_intVarIdx},
    nonVarArgList := {}
  }};
  f_EPTF_Var_subscribeLocal(vl_intSumIdx,vl_providerLocal);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=1));
  f_EPTF_Var_CT_LogAll("----- Sum READY -------");

  // add one local provider
  f_EPTF_Var_addLocalProviders(vl_intSumIdx, {vl_varIdList[1]});
  f_EPTF_Var_refreshContent(vl_intSumIdx);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=101));
  f_EPTF_Var_CT_LogAll("----- +1 local READY -------");
  
  // add two local providers
  f_EPTF_Var_addLocalProviders(vl_intSumIdx, {vl_varIdList[0],vl_varIdList[2]});
  f_EPTF_Var_refreshContent(vl_intSumIdx);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=1111));
  f_EPTF_Var_CT_LogAll("----- +2 local READY -------");
  
  // adjust all vars:
  f_EPTF_Var_adjustContent(vl_intVarIdx, {intVal := 2});
  f_EPTF_Var_adjustContent(vl_varIdList[0], {intVal := 20});
  f_EPTF_Var_adjustContent(vl_varIdList[1], {intVal := 200});
  f_EPTF_Var_adjustContent(vl_varIdList[2], {intVal := 2000});
  t_wait.start; t_wait.timeout; // let the var update the variables
  
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=2222));
  f_EPTF_Var_CT_LogAll("----- Adjust 2 READY -------");
  
  // remove 2 subscribers:
  f_EPTF_Var_removeLocalProviders(vl_intSumIdx, {vl_intVarIdx,vl_varIdList[2]});
  f_EPTF_Var_refreshContent(vl_intSumIdx);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=220));
  f_EPTF_Var_CT_LogAll("----- remove local 2 READY -------");
  
  
  // remove all subscribers (even ones that were removed):
  f_EPTF_Var_removeLocalProviders(vl_intSumIdx, vl_varIdList);
  f_EPTF_Var_refreshContent(vl_intSumIdx);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=0));
  f_EPTF_Var_CT_LogAll("----- remove local all READY -------");
  
  // add one local provider
  f_EPTF_Var_addLocalProviders(vl_intSumIdx, {vl_intVarIdx});
  f_EPTF_Var_refreshContent(vl_intSumIdx);
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=2));
  f_EPTF_Var_CT_LogAll("----- +1 local READY -------");
  
  // adjust all vars:
  f_EPTF_Var_adjustContent(vl_intVarIdx, {intVal := 3});
  f_EPTF_Var_adjustContent(vl_varIdList[0], {intVal := 30});
  f_EPTF_Var_adjustContent(vl_varIdList[1], {intVal := 300});
  f_EPTF_Var_adjustContent(vl_varIdList[2], {intVal := 3000});
  t_wait.start; t_wait.timeout; // let the var update the variables
  
  f_setverdictFail((f_EPTF_Var_getIntValue(vl_intSumIdx)!=3));
  f_EPTF_Var_CT_LogAll("----- Adjust 3 READY -------");
  
  setverdict(pass);
}

type component Var_GetRemote_CT extends EPTF_Var_CT {
  timer t_getRemote := 0.0;
  var integer v_getRemoteCounter := 0;
}

altstep as_EPTF_Var_getRemote() runs on Var_GetRemote_CT  {
  [] t_getRemote.timeout {
    if(v_getRemoteCounter==3) {
      repeat;
    }
    t_getRemote.start;
    var EPTF_Var_DirectContent vl_remoteValue;
    v_getRemoteCounter := v_getRemoteCounter + 1;
    var charstring vl_varName := "intVar"&int2str(v_getRemoteCounter);
    f_EPTF_Var_getRemoteContent(self,vl_varName, vl_remoteValue);
    f_setverdictFail(v_getRemoteCounter==1);
    var EPTF_Var_DirectContent vl_currentContent;
    f_EPTF_Var_getContent(f_EPTF_Var_getId(vl_varName),vl_currentContent);
    log("remote/current content of intVar is: ", vl_remoteValue,"/",vl_currentContent);
    f_setverdictFail(vl_remoteValue!=vl_currentContent);
    repeat;
  }
}

testcase tc_EPTF_Var_getRemote() runs on Var_GetRemote_CT {
  f_EPTF_Var_init_CT("getRemote");
  
  var integer vl_idx;
  f_EPTF_Var_newInt("intVar1",1,vl_idx);
  f_EPTF_Var_newInt("intVar2",2,vl_idx);
  f_EPTF_Var_newInt("intVar3",3,vl_idx);
  
  t_getRemote.start;
  var default vl_def := activate(as_EPTF_Var_getRemote());
  
  timer t_wait := 2.0;
  t_wait.start; t_wait.timeout;
  f_setverdictFail(v_getRemoteCounter!=3);
  f_EPTF_Base_stop(pass);
}

testcase tc_EPTF_Var_test_error() runs on VarTest_CT {
  f_EPTF_Var_CT_LogAll("----- START -------");
  f_EPTF_Var_init_CT("ErrorTest");
  f_EPTF_Var_CT_LogAll("----- INIT READY -------");
  
  action("---THIS TESTCASE SHOULD FAIL---");
  
  f_EPTF_Var_enableDebug();
  
  var integer vl_idx;
  f_EPTF_Var_newInt("sameName", 0, vl_idx);
  f_EPTF_Var_newInt("sameName", 1, vl_idx);

  f_EPTF_Base_stop(pass);
}

}// end of module
