blob: 28224b9e1d41869635ad854e043824ede15743e1 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 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_FBQ_Test
{
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_FBQ_Definitions all;
import from EPTF_CLL_FBQ_Functions all;
import from TCCEnv_Functions all;
//FIX Me
//import from EPTF_CLL_FBQ_PrivateFunctions all;
//=========================================================================
// Module Parameters
//=========================================================================
//modulepar integer tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables := 1;
//=========================================================================
// Data Types
//=========================================================================
type record of integer EPTF_FBQ_Test_IntegerList;
//=========================================================================
//Component Types
//=========================================================================
type component EPTF_FBQ_Test_CT extends EPTF_FBQ_CT
{
var EPTF_FreeBusyQueue v_queue;
var integer v_idx;
var boolean v_success;
}
//=========================================================================
// Functions
//=========================================================================
////////////////////////////////////////////////////////////////////
function f_FBQ_Test_checkQueue(
in EPTF_FreeBusyQueue pl_queue,
in EPTF_FBQ_Test_IntegerList pl_freeChain,
in EPTF_FBQ_Test_IntegerList pl_busyChain) return boolean
{
var EPTF_FBQ_Test_IntegerList vl_getFreeChain := {};
var EPTF_FBQ_Test_IntegerList vl_getBusyChain := {};
var integer vl_getHeadIdx;
//store free chain
if(f_EPTF_FBQ_getFreeHeadIdx(vl_getHeadIdx, pl_queue)) {
vl_getFreeChain[0] := vl_getHeadIdx;
while(f_EPTF_FBQ_getFwdFreeItemIdx(vl_getHeadIdx, pl_queue)) {
vl_getFreeChain[sizeof(vl_getFreeChain)] := vl_getHeadIdx;
}
}
//store busy chain
if(f_EPTF_FBQ_getBusyHeadIdx(vl_getHeadIdx, pl_queue)) {
vl_getBusyChain[0] := vl_getHeadIdx;
while(f_EPTF_FBQ_getFwdBusyItemIdx(vl_getHeadIdx, pl_queue)) {
vl_getBusyChain[sizeof(vl_getBusyChain)] := vl_getHeadIdx;
}
}
//match chains
if(vl_getFreeChain == pl_freeChain and vl_getBusyChain == pl_busyChain) {
return true;
} else {
log("not matched, free chain: ", vl_getFreeChain, " expected: ", pl_freeChain,
", busy chain: ", vl_getBusyChain, " expected: ", pl_busyChain);
return false;
}
}
function f_FBQ_Test_createBusyElems(
inout EPTF_FreeBusyQueue pl_queue,
in integer pl_num)
runs on EPTF_FBQ_Test_CT
{
var integer i := 0;
for(i := 0; i < pl_num; i := i + 1) {
f_EPTF_FBQ_moveFromFreeToBusyTail(
f_EPTF_FBQ_getOrCreateFreeSlot(pl_queue),
pl_queue);
}
}
//=========================================================================
// Testcases
//=========================================================================
testcase tc_EPTF_FBQ_Test_getQueueDidx() runs on EPTF_FBQ_Test_CT
{
var EPTF_IndexList vl_setData := {2,3};
var EPTF_IndexList vl_getData;
f_EPTF_FBQ_init_CT("getQueueDidx");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
v_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_queue);
//set the data indices of the first queue item
f_EPTF_FBQ_setQueueDidx( 0, vl_setData, v_queue);
f_EPTF_FBQ_getQueueDidx(v_idx, v_queue, vl_getData);
if (vl_getData == vl_setData) {
setverdict(pass);
} else {
log("Error: wrong data indeces stored: ", vl_getData, " expected: ", vl_setData);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_createFreeSlots() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getNofFreeSlots;
var integer vl_getNofBusySlots;
f_EPTF_FBQ_init_CT("createFreeSlots");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
vl_getNofBusySlots := f_EPTF_FBQ_getLengthOfBusyChain(v_queue);
vl_getNofFreeSlots := f_EPTF_FBQ_getLengthOfFreeChain(v_queue);
if (vl_getNofBusySlots == 1 and vl_getNofFreeSlots == vl_setNofFreeSlots *2 - 1) {
setverdict(pass);
} else {
log("Error: wrong free slot creation, noumber of slots: ", vl_getNofFreeSlots, " expected: ", vl_setNofFreeSlots *2 - 1);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getFreeSlot() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getFreeSlotIdx;
f_EPTF_FBQ_init_CT("getFreeSlot");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
//
vl_getFreeSlotIdx := f_EPTF_FBQ_getFreeSlot(v_queue);
if (vl_getFreeSlotIdx == -1) {
setverdict(pass);
} else {
log("Error: v_queue has a free slot: ", v_queue);
setverdict(fail);
}
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
vl_getFreeSlotIdx := f_EPTF_FBQ_getFreeSlot(v_queue);
if (vl_getFreeSlotIdx != -1) {
setverdict(pass);
} else {
log("Error: v_queue has not free slot: ", v_queue);
setverdict(fail);
}
for(var integer i := 0; i < vl_setNofFreeSlots; i := i + 1)
{
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
}
vl_getFreeSlotIdx := f_EPTF_FBQ_getFreeSlot(v_queue);
if (vl_getFreeSlotIdx == -1) {
setverdict(pass);
} else {
log("Error: v_queue has a free slot: ", v_queue);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_moveFromFreeHeadToBusy() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getNofFreeSlots;
var integer vl_getNofBusySlots;
var integer vl_getFreeHeadIdx;
var integer vl_oldIdx;
var integer vl_getBusyHeadIdx;
f_EPTF_FBQ_init_CT("moveFromFreeHeadToBusy");
// queue initialized with 7 slots in the free chain in this order:
// 0->1->2->...->6 (-> shows the fwd pointer's direction, going from head to tail)
// fwd pointer goes towards tail, bwd pointer towards head
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
v_success := f_EPTF_FBQ_getFreeHeadIdx(vl_getFreeHeadIdx, v_queue);
//f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
// free head is at index 0
// move index 0 to the empty busy chain -> #0 becomes busy head and tail
// #1 becomes new free head
f_EPTF_FBQ_moveFromFreeHeadToBusy(vl_getFreeHeadIdx, empty, 0, 0, v_queue);
action("busy lenght: ", f_EPTF_FBQ_getLengthOfBusyChain(v_queue));
action("free lenght: ", f_EPTF_FBQ_getLengthOfFreeChain(v_queue));
if (f_EPTF_FBQ_itemIsBusy(vl_getFreeHeadIdx, v_queue)) {
setverdict(pass);
} else {
log("Error: ", vl_getFreeHeadIdx," item is not busy");
setverdict(fail);
}
vl_oldIdx := vl_getFreeHeadIdx;
v_success := f_EPTF_FBQ_getFreeHeadIdx(vl_getFreeHeadIdx, v_queue);
if (vl_oldIdx != vl_getFreeHeadIdx) {
setverdict(pass);
} else {
log("Error: free head index not changed, new: ", vl_getFreeHeadIdx, " old: ", vl_oldIdx);
setverdict(fail);
}
vl_getNofBusySlots := f_EPTF_FBQ_getLengthOfBusyChain(v_queue);
vl_getNofFreeSlots := f_EPTF_FBQ_getLengthOfFreeChain(v_queue);
if(vl_getNofBusySlots == 1 and vl_getNofFreeSlots == vl_setNofFreeSlots - 1){
setverdict(pass);
} else {
log("Error: busy and free queues's length not changed, number of free: ", vl_getNofFreeSlots, " expected: ", vl_setNofFreeSlots - 1, ", busy: ", vl_getNofBusySlots, " expected: 1");
setverdict(fail);
}
v_success := f_EPTF_FBQ_getBusyHeadIdx(vl_getBusyHeadIdx, v_queue);
// free head index is 1
// move #1 to busy chain's head slot, busy chain becomes: 1->0
f_EPTF_FBQ_moveFromFreeHeadToBusy(vl_getFreeHeadIdx, head, 0, 0, v_queue);
if (f_EPTF_FBQ_itemIsBusy(vl_getFreeHeadIdx, v_queue)) {
setverdict(pass);
} else {
log("Error: ", vl_getFreeHeadIdx," item is not busy");
setverdict(fail);
}
vl_oldIdx := vl_getBusyHeadIdx;
v_success := f_EPTF_FBQ_getBusyHeadIdx(vl_getBusyHeadIdx, v_queue);
if (vl_getBusyHeadIdx != vl_oldIdx) {
setverdict(pass);
} else {
log("Error: busy head index not changed, new: ", vl_getBusyHeadIdx, " old: ", vl_oldIdx);
setverdict(fail);
}
v_success := f_EPTF_FBQ_getFreeHeadIdx(vl_getFreeHeadIdx, v_queue);
// free head index is 2
// move #2 to the middle of the busy chain between head(1) and tail(0)
// busy chain becomes: 1->2->0
f_EPTF_FBQ_moveFromFreeHeadToBusy(vl_getFreeHeadIdx, middle, 1, 0, v_queue);
vl_oldIdx := vl_getFreeHeadIdx;
// fwd pointer of element #2 shall point towards tail, i.e. #0
v_success := f_EPTF_FBQ_getFwdBusyItemIdx(vl_getFreeHeadIdx, v_queue);
if (vl_getFreeHeadIdx == 0) {
setverdict(pass);
} else {
log("Error: wrong forward busy item index: ", vl_getFreeHeadIdx, " expected: 1");
setverdict(fail);
}
vl_getFreeHeadIdx := vl_oldIdx;
// bwd pointer of element #2 shall point towards head, i.e. #1
v_success := f_EPTF_FBQ_getBwdBusyItemIdx(vl_getFreeHeadIdx, v_queue);
if (vl_getFreeHeadIdx == 1) {
setverdict(pass);
} else {
log("Error: wrong backward busy item index: ", vl_getFreeHeadIdx, " expected: 0");
log(v_queue);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_moveFromFreeToBusyTail() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("moveFromFreeToBusyTail");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
//move free head
v_success := f_EPTF_FBQ_getFreeHeadIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromFreeToBusyTail(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {1,2,3,4,5,6}, {0})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move free tail
v_success := f_EPTF_FBQ_getFreeTailIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromFreeToBusyTail(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {1,2,3,4,5}, {0,6})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move free middle
f_EPTF_FBQ_moveFromFreeToBusyTail(3, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {1,2,4,5}, {0,6,3})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_moveFromBusyToFreeHead() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("moveFromBusyToFreeHead");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
for(var integer i := 0; i < vl_setNofFreeSlots; i := i + 1)
{
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
}
//move busy head
v_success := f_EPTF_FBQ_getBusyHeadIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromBusyToFreeHead(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {0}, {1,2,3,4,5,6})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move busy tail
v_success := f_EPTF_FBQ_getBusyTailIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromBusyToFreeHead(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {6,0}, {1,2,3,4,5})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move busy middle
f_EPTF_FBQ_moveFromBusyToFreeHead(3, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {3,6,0}, {1,2,4,5})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_moveFromBusyToFreeTail() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("moveFromBusyToFreeTail");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
for(var integer i := 0; i < vl_setNofFreeSlots; i := i + 1)
{
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
}
//move busy head
v_success := f_EPTF_FBQ_getBusyHeadIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromBusyToFreeTail(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {0}, {1,2,3,4,5,6})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move busy tail
v_success := f_EPTF_FBQ_getBusyTailIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromBusyToFreeTail(v_idx, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {0,6}, {1,2,3,4,5})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
//move busy middle
f_EPTF_FBQ_moveFromBusyToFreeTail(3, v_queue);
if(f_FBQ_Test_checkQueue(v_queue, {0,6,3}, {1,2,4,5})) {
setverdict(pass);
} else {
log("Error: Wrong moving behavior");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getBusyHeadIdx() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("getBusyHeadIdx");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
if(f_EPTF_FBQ_getBusyHeadIdx(v_idx, v_queue)) {
if (v_idx == 0) {
setverdict(pass);
} else {
log("Error: wrong busy head index: ", v_idx, " expected: 0");
setverdict(fail);
}
} else {
log("Error: no busy Head index");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getFwdBusyItemIdx() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("getFwdBusyItemIdx");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
v_idx := 0;
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
if(not f_EPTF_FBQ_getFwdBusyItemIdx(v_idx, v_queue)) {
setverdict(pass);
} else {
log("Error: more than one item in busy chain");
setverdict(fail);
}
v_idx := 0;
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
if(f_EPTF_FBQ_getFwdBusyItemIdx(v_idx, v_queue)) {
if (v_idx == 1) {
setverdict(pass);
} else {
log("Error: wrong forward busy item index: ", v_idx, " expected: 1");
setverdict(fail);
}
} else {
log("Error: only one busy item");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getBwdBusyItemIdx() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("getBwdBusyItemIdx");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
v_idx := 0;
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
if(not f_EPTF_FBQ_getBwdBusyItemIdx(v_idx, v_queue)) {
setverdict(pass);
} else {
log("Error: more than one item in busy chain");
setverdict(fail);
}
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
v_idx := 1;
if(f_EPTF_FBQ_getBwdBusyItemIdx(v_idx, v_queue)) {
if (v_idx == 0) {
setverdict(pass);
} else {
log("Error: wrong backward busy item index: ", v_idx, " expected: 1");
setverdict(fail);
}
} else {
log("Error: only one busy item");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_itemIsBusy() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("itemIsBusy");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
v_success := f_EPTF_FBQ_getBusyHeadIdx(v_idx, v_queue);
if(f_EPTF_FBQ_itemIsBusy(v_idx, v_queue)) {
setverdict(pass);
} else {
log("Error: not a busy item: ", v_idx);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_itemIsFree() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("itemIsFree");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
v_success := f_EPTF_FBQ_getFreeHeadIdx(v_idx, v_queue);
if(f_EPTF_FBQ_itemIsFree(v_idx, v_queue)) {
setverdict(pass);
} else {
log("Error: not a free item: ", v_idx);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_itemIsInvalid() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
f_EPTF_FBQ_init_CT("itemIsInvalid");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
v_success := f_EPTF_FBQ_getBusyHeadIdx(v_idx, v_queue);
f_EPTF_FBQ_moveFromBusyToInvalid(v_idx, v_queue);
if(f_EPTF_FBQ_itemIsInvalid(v_idx, v_queue)) {
setverdict(pass);
} else {
log("Error: not an invalid item: ", v_idx);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getLengthOfBusyChain() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getLengthChain;
f_EPTF_FBQ_init_CT("getLengthOfBusyChain");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
vl_getLengthChain := f_EPTF_FBQ_getLengthOfBusyChain(v_queue);
if(vl_getLengthChain == 0) {
setverdict(pass);
} else {
log("Error: not empty busy chain, length: ", vl_getLengthChain);
setverdict(fail);
}
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
vl_getLengthChain := f_EPTF_FBQ_getLengthOfBusyChain(v_queue);
if(vl_getLengthChain == 1) {
setverdict(pass);
} else {
log("Error: wrong busy chain length: ", vl_getLengthChain," expected: 1");
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_getLengthOfFreeChain() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getLengthChain;
f_EPTF_FBQ_init_CT("getLengthOfFreeChain");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
vl_getLengthChain := f_EPTF_FBQ_getLengthOfFreeChain(v_queue);
if(vl_getLengthChain == vl_setNofFreeSlots) {
setverdict(pass);
} else {
log("Error: wrong busy chain length: ", vl_getLengthChain," expected: ", vl_setNofFreeSlots);
setverdict(fail);
}
f_EPTF_FBQ_moveFromFreeHeadToBusyTail(v_queue);
vl_getLengthChain := f_EPTF_FBQ_getLengthOfFreeChain(v_queue);
if(vl_getLengthChain == vl_setNofFreeSlots - 1 ) {
setverdict(pass);
} else {
log("Error: wrong busy chain length: ", vl_getLengthChain," expected: ", vl_setNofFreeSlots - 1);
setverdict(fail);
}
}
testcase tc_EPTF_FBQ_Test_logChain() runs on EPTF_FBQ_Test_CT
{
var integer vl_setNofFreeSlots := 7;
var integer vl_getLengthChain;
f_EPTF_FBQ_init_CT("logChain");
f_EPTF_FBQ_initFreeBusyQueue(v_queue);
f_EPTF_FBQ_createFreeSlots(vl_setNofFreeSlots, v_queue);
f_EPTF_FBQ_logChain(free_chain, v_queue);
setverdict(pass);
}
// This test case should be compiled in debug mode (-DEPTF_DEBUG)
// The logs has to be checked if the warnings are there
testcase tc_FBQ_Test_testFBQGrowage() runs on EPTF_FBQ_Test_CT
{
var EPTF_FreeBusyQueue vl_queue;
var integer i := 0;
f_EPTF_FBQ_init_CT("testFBQGrowage");
f_EPTF_FBQ_initFreeBusyQueue(vl_queue);
if(tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables < 0) {
log(%definitionId&": tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables is less than 0.");
stop;
}
log(%definitionId&": Creating a queue with ", tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables, " elements");
log(%definitionId&": This should cause NO logs about exceeding the max size.");
f_FBQ_Test_createBusyElems(vl_queue, tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables);
f_EPTF_FBQ_initFreeBusyQueue(vl_queue);
log(%definitionId&": Creating a queue with ", tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables + 1, " elements");
log(%definitionId&": This should cause a single log about exceeding the max size.");
f_FBQ_Test_createBusyElems(vl_queue, tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables + 1);
if(tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables > 0) {
f_EPTF_FBQ_initFreeBusyQueue(vl_queue);
log(%definitionId&": Creating a queue with ", 2*tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables, " elements");
log(%definitionId&": This should cause a few logs about exceeding the max size.")
//f_FBQ_Test_createBusyElems(vl_queue, 2 * tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables);
f_EPTF_FBQ_createFreeSlots(2 * tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables, vl_queue);
f_EPTF_FBQ_initFreeBusyQueue(vl_queue);
log(%definitionId&": Creating a queue with ", 100*tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables, " elements");
log(%definitionId&": This should cause more logs about exceeding the max size.")
f_FBQ_Test_createBusyElems(vl_queue, 100 * tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables);
}
}
control
{
select (f_GetEnv("TTCN_TEST_TYPE")) {
case ("SMOKE") {
execute(tc_EPTF_FBQ_Test_getQueueDidx());
execute(tc_EPTF_FBQ_Test_createFreeSlots());
execute(tc_EPTF_FBQ_Test_getFreeSlot());
execute(tc_EPTF_FBQ_Test_moveFromFreeHeadToBusy());
execute(tc_EPTF_FBQ_Test_moveFromFreeToBusyTail());
execute(tc_EPTF_FBQ_Test_moveFromBusyToFreeHead());
execute(tc_EPTF_FBQ_Test_moveFromBusyToFreeTail());
execute(tc_EPTF_FBQ_Test_getBusyHeadIdx());
execute(tc_EPTF_FBQ_Test_getFwdBusyItemIdx());
execute(tc_EPTF_FBQ_Test_getBwdBusyItemIdx());
execute(tc_EPTF_FBQ_Test_itemIsBusy());
execute(tc_EPTF_FBQ_Test_itemIsFree());
execute(tc_EPTF_FBQ_Test_itemIsInvalid());
execute(tc_EPTF_FBQ_Test_getLengthOfBusyChain());
execute(tc_EPTF_FBQ_Test_getLengthOfFreeChain());
execute(tc_EPTF_FBQ_Test_logChain());
//execute(tc_FBQ_Test_testFBQGrowage()); // This is a manual test
}
case else {
execute(tc_EPTF_FBQ_Test_getQueueDidx());
execute(tc_EPTF_FBQ_Test_createFreeSlots());
execute(tc_EPTF_FBQ_Test_getFreeSlot());
execute(tc_EPTF_FBQ_Test_moveFromFreeHeadToBusy());
execute(tc_EPTF_FBQ_Test_moveFromFreeToBusyTail());
execute(tc_EPTF_FBQ_Test_moveFromBusyToFreeHead());
execute(tc_EPTF_FBQ_Test_moveFromBusyToFreeTail());
execute(tc_EPTF_FBQ_Test_getBusyHeadIdx());
execute(tc_EPTF_FBQ_Test_getFwdBusyItemIdx());
execute(tc_EPTF_FBQ_Test_getBwdBusyItemIdx());
execute(tc_EPTF_FBQ_Test_itemIsBusy());
execute(tc_EPTF_FBQ_Test_itemIsFree());
execute(tc_EPTF_FBQ_Test_itemIsInvalid());
execute(tc_EPTF_FBQ_Test_getLengthOfBusyChain());
execute(tc_EPTF_FBQ_Test_getLengthOfFreeChain());
execute(tc_EPTF_FBQ_Test_logChain());
//execute(tc_FBQ_Test_testFBQGrowage()); // This is a manual test
}
}
}
} // end of module