blob: cc5d9fb0d815f8b0212b1dc84f45f55728ddff21 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2017 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_LGenBase_Definitions
module EPTF_NQueue_Test {
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_NQueue_Definitions all;
import from EPTF_CLL_NQueue_Functions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Base_Functions all;
//=========================================================================
// Data Types
//=========================================================================
type record of integer EPTF_NQ_Test_IntegerList;
type enumerated EPTF_NQ_moveDestPos {
Head, Tail, After, Before
};
type enumerated EPTF_NQ_moveFrom {
Head, Tail, Middle
};
//=========================================================================
// Component Part
//=========================================================================
type component EPTF_NQueue_Test_CT extends EPTF_NQueue_CT
{
var EPTF_NQueue_QueueId v_queueId;
}
//=========================================================================
// Functions Part
//=========================================================================
///////////////////////////////////////////////////////////
// Function: f_EPTF_NQueue_Test_checkQueue
//
// Purpose:
// Function for comparing the state of a chain to the expected state of it
//
// Parameters:
// pl_chain - *in* <EPTF_NQueue_ChainId> - The chain id
// pl_expectedChain - *in* <EPTF_NQ_Test_IntegerList> - An integerlist of the expected state of the chain
//
// Return:
// <boolean>: True if the expected state and the real state of the chain are matching
//
///////////////////////////////////////////////////////////
function f_EPTF_NQueue_Test_checkQueue(
in EPTF_NQueue_ChainId pl_chain,
in EPTF_NQ_Test_IntegerList pl_expectedChain) runs on EPTF_NQueue_Test_CT return boolean
{
var EPTF_NQ_Test_IntegerList vl_getChain := {};
var integer vl_lengthOC:=f_EPTF_NQueue_getLengthOfChain(v_queueId, pl_chain);
if(vl_lengthOC>0){
var EPTF_NQueue_ItemIdx vl_headIdx := f_EPTF_NQueue_getHeadOfChain(v_queueId, pl_chain);
vl_getChain[0] := vl_headIdx;
while(f_EPTF_NQueue_getNextItemIdx(v_queueId, vl_headIdx)) {
vl_getChain[sizeof(vl_getChain)] := vl_headIdx;
}
}
log("Content of chain: ", pl_chain, " is: ", vl_getChain);
log("Expected content of chain: ", pl_chain, " is: ", pl_expectedChain);
if(vl_getChain == pl_expectedChain) {
return true;
} else {
log("No match, chain is: ", vl_getChain, " ,expected: ", pl_expectedChain);
return false;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_NQueue_Test_createNewItem
//
// Purpose:
// Function for testing the create functions of the NQueue feature
//
// Parameters:
// pl_itemNum - *in* <integer> - How many items to be created in the chain
// pl_toHead - *in* <boolean> - Where to create the items in the chain (head or tail)
// pl_itemNumInChain - *in* <integer> - How many items are there already in the chain
//
///////////////////////////////////////////////////////////
function f_EPTF_NQueue_Test_createNewItem(in integer pl_itemNum, in boolean pl_toHead, in integer pl_itemNumInChain)
runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
if(pl_itemNumInChain == 1) {
f_EPTF_NQueue_createItemAtChainHead(v_queueId, vl_chainId);
} else if (pl_itemNumInChain > 1) {
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, pl_itemNumInChain);
}
var EPTF_NQueue_ItemIdx vl_itemIdx := -1;
if( pl_toHead ) {
if(pl_itemNum == 1) {
vl_itemIdx := f_EPTF_NQueue_createItemAtChainHead(v_queueId, vl_chainId);
} else {
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, pl_itemNum);
}
} else {
if(pl_itemNum == 1) {
vl_itemIdx := f_EPTF_NQueue_createItemAtChainTail(v_queueId, vl_chainId);
} else {
f_EPTF_NQueue_createItemsAtChainTail(v_queueId, vl_chainId, pl_itemNum);
}
}
setverdict(pass);
if(pl_itemNum == 1 and f_EPTF_NQueue_getChainOfItem(v_queueId, vl_itemIdx) != vl_chainId) {
setverdict(fail, "Item is not in the desired chain: ", vl_chainId);
}
if(f_EPTF_NQueue_getLengthOfChain(v_queueId, vl_chainId) != pl_itemNumInChain + pl_itemNum) {
setverdict(fail, "Wrong item number in chain: ", f_EPTF_NQueue_getLengthOfChain(v_queueId, vl_chainId), "excepted: ", pl_itemNumInChain + pl_itemNum );
}
if(pl_itemNum == 1 and pl_toHead and f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainId) != vl_itemIdx) {
setverdict(fail, "Wrong head item in chain:", f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainId), "expected:", vl_itemIdx);
}
if(pl_itemNum == 1 and (not pl_toHead) and f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainId) != vl_itemIdx) {
setverdict(fail, "Wrong tail item in chain:", f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainId), "expected:", vl_itemIdx);
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_NQueue_Test_move
//
// Purpose:
// Function for testing all the move functions of NQueue feature
//
// Parameters:
// pl_numFrom - *in* <integer> - The number of items in source chain before move
// pl_numTo - *in* <integer> - The number of items in destination chain before move
// pl_from - *in* <EPTF_NQ_moveFrom> - The position of the item to be moved in the source chain (Head, Middle, Tail)
// pl_dest - *in* <EPTF_NQ_moveDestPos> - To witch position should be the item moved to in the destination chain (Head, After, Before, Tail)
// Idx - *in* <integer> - Used only if the previous parameter is After or Before. -1 if not used
// pl_expectedFrom - *in* <EPTF_NQ_Test_IntegerList> - The expected state of the source chain after the movement
// pl_expectedTo - *in* <EPTF_NQ_Test_IntegerList> - The expected state of the destination chain after the movement
//
///////////////////////////////////////////////////////////
function f_EPTF_NQueue_Test_move(
in integer pl_numFrom,
in integer pl_numTo,
in EPTF_NQ_moveFrom pl_from,
in EPTF_NQ_moveDestPos pl_dest,
in integer Idx := -1,
in EPTF_NQ_Test_IntegerList pl_expectedFrom,
in EPTF_NQ_Test_IntegerList pl_expectedTo)
runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainIdFrom := f_EPTF_NQueue_createChain(v_queueId);
var EPTF_NQueue_ChainId vl_chainIdTo:= f_EPTF_NQueue_createChain(v_queueId);
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainIdFrom, pl_numFrom);
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainIdTo, pl_numTo);
var EPTF_NQueue_ItemIdx vl_toGo;//which element will be moved from the source chain
if(pl_from == Head) {
vl_toGo := f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainIdFrom);
} else if(pl_from == Tail) {
vl_toGo := f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainIdFrom);
} else if(pl_from == Middle){
vl_toGo := f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainIdFrom);
f_EPTF_NQueue_getNextItemIdx(v_queueId, vl_toGo);
}
if( pl_dest == Head ) {
f_EPTF_NQueue_moveToHead(v_queueId, vl_chainIdTo, vl_toGo);
} else if(pl_dest == Tail) {
f_EPTF_NQueue_moveToTail(v_queueId, vl_chainIdTo, vl_toGo);
} else if(pl_dest == Before) {
f_EPTF_NQueue_moveBefore(v_queueId, Idx, vl_toGo);
} else if(pl_dest == After) {
f_EPTF_NQueue_moveAfter(v_queueId, Idx, vl_toGo);
}
setverdict(pass);
if( pl_dest == Head and f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainIdTo) != vl_toGo) {
setverdict(fail, "Wrong chain head at destination chain ");
}
if( pl_dest == Tail and f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainIdTo) != vl_toGo) {
setverdict(fail, "Wrong chain tail at destination chain ");
}
if(pl_dest == Before) {
f_EPTF_NQueue_getPrevItemIdx(v_queueId, Idx);
if(Idx != vl_toGo) {
setverdict(fail, "Item was not moved to the desired position");
}
}
if(pl_dest == After) {
f_EPTF_NQueue_getNextItemIdx(v_queueId, Idx);
if(Idx != vl_toGo) {
setverdict(fail, "Item was not moved to the desired position");
}
}
if(f_EPTF_NQueue_getChainOfItem(v_queueId, vl_toGo) != vl_chainIdTo) {
setverdict(fail, "Item wasn`t moved to the right chain");
}
if(f_EPTF_NQueue_getLengthOfChain(v_queueId, vl_chainIdTo) != (pl_numTo + 1)) {
setverdict(fail, "Wrong item number in destination chain after move");
}
if(f_EPTF_NQueue_getLengthOfChain(v_queueId, vl_chainIdFrom) != (pl_numFrom - 1)) {
setverdict(fail, "Wrong item number in source chain after move");
}
if(not f_EPTF_NQueue_Test_checkQueue(vl_chainIdFrom, pl_expectedFrom)) {
setverdict(fail);
}
if(not f_EPTF_NQueue_Test_checkQueue(vl_chainIdTo, pl_expectedTo)) {
setverdict(fail);
}
f_EPTF_Base_stop(none);
}
//=========================================================================
// Testcases Part
//=========================================================================
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem1
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainTail function if the chain previously is empty
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, false, 0)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem2
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainTail function if the chain previously contains 1 item
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, false, 1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem3
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainTail function if the chain previously contains 2 items
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, false, 2)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem4
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainHead function if the chain previously is empty
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, true, 0)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem5
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainHead function if the chain previously contains 1 item
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, true, 1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem6
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemAtChainHead function if the chain previously containes 2 items
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(1, true, 2)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem7
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainTail function if the chain previously is empty
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, false, 0)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem8
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainTail function if the chain previously containes 1 item
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem8() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, false, 1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem9
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainTail function if the chain previously containes 2 items
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem9() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, false, 2)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem10
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainHead function if the chain previously is empty
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem10() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, true, 0)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem11
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainHead function if the chain previously containes 1 item
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem11() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, true, 1)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createNewItem12
//
// Purpose:
// Tests the f_EPTF_NQueue_createItemsAtChainHead function if the chain previously containes 2 items
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createNewItem12() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_createNewItem(2, true, 2)
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getHeadOfChain
//
// Purpose:
// Tests the f_EPTF_NQueue_getHeadOfChain function
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getHeadOfChain()runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
var integer vl_itemNumInChain := 8;
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, vl_itemNumInChain);
setverdict(pass);
if(f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainId) != 7) {
setverdict(fail, "Wrong head item in chain:", f_EPTF_NQueue_getHeadOfChain(v_queueId, vl_chainId), "expected: 7");
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getTailOfChain
//
// Purpose:
// Tests the f_EPTF_NQueue_getTailOfChain function
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getTailOfChain()runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
var integer vl_itemNumInChain := 8;
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, vl_itemNumInChain);
setverdict(pass);
if(f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainId) != 0) {
setverdict(fail, "Wrong tail item in chain:", f_EPTF_NQueue_getTailOfChain(v_queueId, vl_chainId), "expected: 0");
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead1
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 1 item and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Head, Head, -1, {}, {0,3,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead2
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Head, Head, -1, {0}, {1,4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead3
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Head, Head, -1, {1,0}, {2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead4
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Head, Head, -1, {1,0}, {2,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead5
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Head, Head, -1, {1,0}, {2,4,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead6
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Tail, Head, -1, {}, {0,3,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead7
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Tail, Head, -1, {1}, {0,4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead8
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead8() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Tail, Head, -1, {2,1}, {0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead9
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead9() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Tail, Head, -1, {2,1}, {0,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead10
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead10() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Tail, Head, -1, {2,1}, {0,4,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead11
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead11() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Middle, Head, -1, {}, {0,3,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead12
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead12() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Middle, Head, -1, {1}, {0,4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead13
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead13() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Middle, Head, -1, {2,0}, {1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead14
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead14() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Middle, Head, -1, {2,0}, {1,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead15
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToHead function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead15() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Middle, Head, -1, {2,0}, {1,4,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail1
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Head, Tail, -1,{}, {3,2,1,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail2
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Head, Tail, -1, {0}, {4,3,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail3
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Head, Tail, -1, {1,0}, {2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail4
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Head, Tail, -1, {1,0}, {3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail5
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Head, Tail, -1, {1,0}, {4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail6
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Tail, Tail, -1, {}, {3,2,1,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail7
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Tail, Tail, -1, {1}, {4,3,2,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail8
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail8() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Tail, Tail, -1, {2,1}, {0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail9
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail9() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Tail, Tail, -1, {2,1}, {3,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail10
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail10() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Tail, Tail, -1, {2,1}, {4,3,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail11
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail11() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Middle, Tail, -1, {}, {3,2,1,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail12
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail12() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Middle, Tail, -1, {1}, {4,3,2,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail13
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 0 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail13() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 0, Middle, Tail, -1, {2,0}, {1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail14
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail14() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Middle, Tail, -1, {2,0}, {3,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail15
//
// Purpose:
// Tests the f_EPTF_NQueue_moveToTail function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail15() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Middle, Tail, -1, {2,0}, {4,3,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter1
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Head, After, 2,{}, {3,2,0,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter2
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Head, After, 4, {0}, {4,1,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter3
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Head, After, 3, {1,0}, {3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter4
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Head, After, 3, {1,0}, {4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter5
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Tail, After, 2, {}, {3,2,0,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter6
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Tail, After, 4, {1}, {4,0,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter7
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Tail, After, 3, {2,1}, {3,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter8
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter8() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Tail, After, 3, {2,1}, {4,3,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter9
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter9() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Middle, After, 3, {}, {3,0,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter10
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter10() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Middle, After, 2, {1}, {4,3,2,0});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter11
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter11() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Middle, After, 3, {2,0}, {3,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter12
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter12() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Middle, After, 4, {2,0}, {4,1,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore1
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Head, Before, 2,{}, {3,0,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore2
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Head, Before, 4, {0}, {1,4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore3
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Head, Before, 3, {1,0}, {2,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore4
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the head of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Head, Before, 3, {1,0}, {4,2,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore5
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Tail, Before, 2, {}, {3,0,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore6
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Tail, Before, 4, {1}, {0,4,3,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore7
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Tail, Before, 3, {2,1}, {0,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore8
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the tail of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore8() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Tail, Before, 3, {2,1}, {4,0,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore9
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 1 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore9() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(1, 3, Middle, Before, 3, {}, {0,3,2,1});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore10
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 2 items and the destination chain containes 3 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore10() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(2, 3, Middle, Before, 2, {1}, {4,3,0,2});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore11
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 1 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore11() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 1, Middle, Before, 3, {2,0}, {1,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore12
//
// Purpose:
// Tests the f_EPTF_NQueue_moveAfter function if the source chain contains 3 items and the destination chain containes 2 items,
// and the item is being moved is from the middle of the source chain
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore12() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_Test_move(3, 2, Middle, Before, 4, {2,0}, {1,4,3});
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getNextItemIdx
//
// Purpose:
// Tests the f_EPTF_NQueue_getNextItemIdx function
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getNextItemIdx()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
var integer vl_itemNumInChain := 8;
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, vl_itemNumInChain);
setverdict(pass);
var EPTF_NQueue_ItemIdx next := 6;
f_EPTF_NQueue_getNextItemIdx(v_queueId, next)
if(next != 5) {
setverdict(fail, "Wrong next item", next, "expected: 5");
}
next := 0;
f_EPTF_NQueue_getNextItemIdx(v_queueId, next)
if(next != 0) {
setverdict(fail, "Wrong next item", next, "expected: 0");
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getPrevItemIdx
//
// Purpose:
// Tests the f_EPTF_NQueue_getPrevItemIdx function
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getPrevItemIdx()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
var integer vl_itemNumInChain := 8;
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, vl_itemNumInChain);
setverdict(pass);
var EPTF_NQueue_ItemIdx prev := 6;
f_EPTF_NQueue_getPrevItemIdx(v_queueId, prev)
if(prev != 7) {
setverdict(fail, "Wrong prev item", prev, "expected: 7");
}
prev := 7;
f_EPTF_NQueue_getPrevItemIdx(v_queueId, prev)
if(prev != 7) {
setverdict(fail, "Wrong prev item", prev, "expected: 7");
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getLengthOfChain
//
// Purpose:
// Tests the f_EPTF_NQueue_getLengthOfChain function with a chain containing none items, and one containing some items
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getLengthOfChain()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(v_queueId);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(v_queueId);
var integer vl_count := 4;
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId1, vl_count);
setverdict(pass);
if(f_EPTF_NQueue_getLengthOfChain( v_queueId, vl_chainId1) != vl_count) {
setverdict(fail, "Wrong item count in chain1: ", f_EPTF_NQueue_getLengthOfChain( v_queueId, vl_chainId1), " expected: ", vl_count);
}
if(f_EPTF_NQueue_getLengthOfChain( v_queueId, vl_chainId2) != 0) {
setverdict(fail, "Wrong item count in chain2: ", f_EPTF_NQueue_getLengthOfChain( v_queueId, vl_chainId2), " expected: ", 0);
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getf_EPTF_NQueue_getChainOfItem
//
// Purpose:
// Tests the f_EPTF_NQueue_getChainOfItem function with two chaines, each containing 1 item
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getf_EPTF_NQueue_getChainOfItem()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(v_queueId);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(v_queueId);
var EPTF_NQueue_ItemIdx vl_item1 := f_EPTF_NQueue_createItemAtChainHead(v_queueId, vl_chainId1);
var EPTF_NQueue_ItemIdx vl_item2 := f_EPTF_NQueue_createItemAtChainHead(v_queueId, vl_chainId2);
setverdict(pass);
var EPTF_NQueue_ChainId vl_tmp := f_EPTF_NQueue_getChainOfItem(v_queueId, vl_item1);
if(vl_tmp != vl_chainId1)
{
setverdict(fail, "Wrong chain of item 1: ", vl_tmp, " expected: ", vl_chainId1);
}
vl_tmp := f_EPTF_NQueue_getChainOfItem(v_queueId, vl_item2);
if(vl_tmp != vl_chainId2)
{
setverdict(fail, "Wrong chain of item 2: ", vl_tmp, " expected: ", vl_chainId2);
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChain
//
// Purpose:
// Tests the f_EPTF_NQueue_logChain function, if it runs the test is successful
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChain()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, 4);
f_EPTF_NQueue_logChain(v_queueId, vl_chainId);
setverdict(pass);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logQueue
//
// Purpose:
// Tests the f_EPTF_NQueue_logQueue function, if it runs the test is successful
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logQueue()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, 4);
f_EPTF_NQueue_logQueue(v_queueId);
setverdict(pass);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChainFields
//
// Purpose:
// Tests the f_EPTF_NQueue_logChainFields function, if it runs the test is successful
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChainFields()runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
v_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(v_queueId);
f_EPTF_NQueue_createItemsAtChainHead(v_queueId, vl_chainId, 4);
f_EPTF_NQueue_logChainFields(v_queueId, vl_chainId);
setverdict(pass);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_NQueue_Test_checkQueueOrder
//
// Purpose:
// This function checks the order of the given chain in a given queue with the expected one.
//
// Parameters:
// pl_queueId - *in* <EPTF_NQueue_QueueId> - Queue id
// pl_chainId - *in* <EPTF_NQueue_ChainId> - Chain Id
// pl_expectedChain - *in* <EPTF_IntegerList> - expected chain order
// pl_errorMsg - *in* *charstring* - error message to include in verdict in case needed
//
// Return Value:
// -
///////////////////////////////////////////////////////////
function f_EPTF_NQueue_Test_checkQueueOrder(
in EPTF_NQueue_QueueId pl_queueId,
in EPTF_NQueue_ChainId pl_chainId,
in EPTF_IntegerList pl_expectedChain,
in charstring pl_errorMsg := "")
{
var EPTF_IntegerList vl_getChain := {};
var EPTF_NQueue_ItemIdx vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(pl_queueId, pl_chainId);
vl_getChain[0] := vl_nextIdx;
while(f_EPTF_NQueue_getNextItemIdx(pl_queueId, vl_nextIdx)) {
vl_getChain[sizeof(vl_getChain)] := vl_nextIdx;
}
if(vl_getChain == pl_expectedChain) {
setverdict(pass)
} else {
setverdict(fail, pl_errorMsg & " - chain: ", vl_getChain, " expected: ", pl_expectedChain);
}
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_deleteQueue1
//
// Purpose: This is a negative test
// Tests the f_EPTF_NQueue_deleteQueue function
//
// Requirement:
// -
//
// Action:
// It checks, whether it does really delete the queue,
// the deleted queue cannot be used again.
//
// Expected result:
// The correct assert message should appear, the test should pass.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
f_EPTF_NQueue_deleteQueue(vl_queue);
// Try to use the same queue that already has been deleted, so the next line should fail
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_deleteQueue2
//
// Purpose: This is a negative test
// Tests the f_EPTF_NQueue_deleteQueue function
//
// Requirement:
// -
//
// Action:
// It checks, whether it does really delete the queue even if a chain belongs to it,
// the deleted queue cannot be used again.
//
// Expected result:
// The correct assert message should appear, the test should pass.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_deleteQueue(vl_queue);
// Try to use the same queue that already has been deleted, so the next line should fail
vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_deleteQueue3
//
// Purpose: This is a negative test
// Tests the f_EPTF_NQueue_deleteQueue function
//
// Requirement:
// -
//
// Action:
// It checks, whether it cannot delete the queue if the queue is already deleted
//
// Expected result:
// The correct assert message should appear, the test should pass.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
f_EPTF_NQueue_deleteQueue(vl_queue);
// Try to delete the same queue that already has been deleted, so the next line should fail
f_EPTF_NQueue_deleteQueue(vl_queue);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_deleteQueue4
//
// Purpose: This is a negative test
// Tests the f_EPTF_NQueue_deleteQueue function
//
// Requirement:
// -
//
// Action:
// It checks, whether the f_EPTF_NQueue_deleteQueue function cannot delete
// a non-existent queue and shows an error.
//
// Expected result:
// The correct assert message should appear, the test should pass.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
// Try to delete the queue that has never existed, so the next line should fail
f_EPTF_NQueue_deleteQueue(vl_queue+10);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_deleteQueue5
//
// Purpose: This is a negative test
// Tests the f_EPTF_NQueue_deleteQueue function.
//
// Requirement:
// -
//
// Action:
// Does it really delete the queue and the chain that belongs to it and
// the deleted chain should not be able to be used again - createItem should fail.
//
// Expected result:
// The correct assert message should appear, the test should pass.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_deleteQueue(vl_queue);
// Try to use the same queue that already has been deleted, so the next line should fail
f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_Neg_deleteQueue6
//
// Purpose:
// This is a negative test.
// Test if an item is available after deleting the queue that contained it.
//
// Requirement:
// -
//
// Action:
// It creates a queue with a chain and one item and after deleting the queue
// it tries to get an item from the queue with an index of -1.
//
// Expected result:
// Tc is passed if the proper assertion (it contained "invalid queue")
// was catched.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue6() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId);
f_EPTF_NQueue_deleteQueue(vl_queue);
// Try to use the same queue that already has been deleted, so the next line should fail
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_itemIdx);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_Neg_deleteQueue7
//
// Purpose:
// This is a negative test.
// Test the f_EPTF_NQueue_createItemAtChainHead function with the index of
// an already deleted queue.
//
// Requirement:
// -
//
// Action:
// It creates a queue with a chain and after deleting the queue it
// tries to create a new item at the head of the chain.
//
// Expected result:
// Tc is passed if the proper assertion (it contained "invalid queue")
// was catched.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_deleteQueue7() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
f_EPTF_NQueue_deleteQueue(vl_queueId);
f_EPTF_NQueue_createItemAtChainHead(vl_queueId, vl_chainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Constant: c_maxChainSize
//
// Purpose:
// Integer constant - it tells the tests how many times the createItems... functions should be called after each other.
//
///////////////////////////////////////////////////////////
const integer c_maxChainSize := 5;
///////////////////////////////////////////////////////////
// Constant: c_maxBurstSize
//
// Purpose:
// Integer constant - it tells the tests how much items should be created during the createItems... functions.
//
///////////////////////////////////////////////////////////
const integer c_maxBurstSize := 3;
///////////////////////////////////////////////////////////
// Constant: c_order
//
// Purpose:
// IntegerList constant - an order of numbers to which the result of the tests should be compared
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_order := {0,1,2,3,4}
///////////////////////////////////////////////////////////
// Constant: c_reversedOrder
//
// Purpose:
// IntegerList constant - a reversed order of numbers to which the result of the tests should be compared
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_reversedOrder := {4,3,2,1,0}
///////////////////////////////////////////////////////////
// Constant: c_burstOrder
//
// Purpose:
// IntegerList constant - an order of numbers to which the result of the tests should be compared (at bursted createItems.. calls)
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_burstOrder := {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}
///////////////////////////////////////////////////////////
// Constant: c_burstReversedOrder
//
// Purpose:
// IntegerList constant - a reversed order of numbers to which the result of the tests should be compared (at bursted createItems.. calls)
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_burstReversedOrder := {14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}
///////////////////////////////////////////////////////////
// Constant: c_scatteredOrder
//
// Purpose:
// IntegerList constant - a scattered order of numbers to which the result of the tests should be compared
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_scatteredOrder := {3,1,4,2,0}
///////////////////////////////////////////////////////////
// Constant: c_scattered2Order
//
// Purpose:
// IntegerList constant - an other scattered order of numbers to which the result of the tests should be compared
//
///////////////////////////////////////////////////////////
const EPTF_IntegerList c_scattered2Order := {1,3,0,2,4}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_createItemFunctions
//
// Purpose:
// This test checks the f_EPTF_NQueue_createItemAtChainHead, f_EPTF_NQueue_createItemAtChainTail,
// f_EPTF_NQueue_createItemsAtChainHead, f_EPTF_NQueue_createItemsAtChainTail,
// f_EPTF_NQueue_createItemAfter, f_EPTF_NQueue_createItemBefore functions.
//
// Requirement:
// -
//
// Action:
// 6 queue is created with 3 chains on each, and into the middle chains items are created with the different
// functions.
//
// Expected result:
// Test passes if the functions above work correctly.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createItemFunctions() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queueHead := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueTail := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueMHead := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueMTail := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueAfter := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueBefore := f_EPTF_NQueue_createQueue();
setverdict(pass);
//f_EPTF_NQueue_createItemAtChainHead test
var EPTF_NQueue_ChainId vl_headChainId := f_EPTF_NQueue_createChain(vl_queueHead);
vl_headChainId := f_EPTF_NQueue_createChain(vl_queueHead);
var EPTF_NQueue_ChainId vl_headChainId2 := f_EPTF_NQueue_createChain(vl_queueHead);
var EPTF_NQueue_ItemIdx vl_retHead := 0;
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueHead, vl_headChainId);
if(vl_retHead != vl_i){ setverdict(fail, "Wrong return value during createItemAtChainHead ret:" & int2str(vl_retHead) & " It should be : " & int2str(vl_i) );}
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueHead, vl_headChainId, c_reversedOrder, "createItemAtChainHead basic error");
//f_EPTF_NQueue_createItemAtChainTail test
var EPTF_NQueue_ChainId vl_tailChainId := f_EPTF_NQueue_createChain(vl_queueTail);
vl_tailChainId := f_EPTF_NQueue_createChain(vl_queueTail);
var EPTF_NQueue_ChainId vl_tailChainId2 := f_EPTF_NQueue_createChain(vl_queueTail);
var EPTF_NQueue_ItemIdx vl_retTail := 0;
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_queueTail, vl_tailChainId);
if(vl_retTail != vl_i){ setverdict(fail, "Wrong return value during createItemAtChainTail ret:" & int2str(vl_retTail) & " It should be : " & int2str(vl_i) );}
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueTail, vl_tailChainId, c_order, "createItemAtChainTail basic error");
//f_EPTF_NQueue_createItemsAtChainHead test
var EPTF_NQueue_ChainId vl_head2ChainId := f_EPTF_NQueue_createChain(vl_queueMHead);
vl_head2ChainId := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ChainId vl_head2ChainId2 := f_EPTF_NQueue_createChain(vl_queueMHead);
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_head2ChainId, c_maxBurstSize );
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_head2ChainId, c_burstReversedOrder, "createItemsAtChainHead basic error");
//f_EPTF_NQueue_createItemsAtChainTail test
var EPTF_NQueue_ChainId vl_tail2ChainId := f_EPTF_NQueue_createChain(vl_queueMTail);
vl_tail2ChainId := f_EPTF_NQueue_createChain(vl_queueMTail);
var EPTF_NQueue_ChainId vl_tail2ChainId2 := f_EPTF_NQueue_createChain(vl_queueMTail);
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_createItemsAtChainTail(vl_queueMTail, vl_tail2ChainId, c_maxBurstSize);
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMTail, vl_tail2ChainId, c_burstOrder, "createItemsAtChainTail basic error");
var EPTF_NQueue_ChainId vl_after2ChainId := f_EPTF_NQueue_createChain(vl_queueAfter);
vl_after2ChainId := f_EPTF_NQueue_createChain(vl_queueAfter);
var EPTF_NQueue_ChainId vl_after2ChainId2 := f_EPTF_NQueue_createChain(vl_queueAfter);
vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueAfter, vl_after2ChainId);
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retHead := f_EPTF_NQueue_createItemAfter(vl_queueAfter, vl_retHead);
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueAfter, vl_after2ChainId, c_order, "createItemAfter basic error");
var EPTF_NQueue_ChainId vl_before2ChainId := f_EPTF_NQueue_createChain(vl_queueBefore);
vl_before2ChainId := f_EPTF_NQueue_createChain(vl_queueBefore);
var EPTF_NQueue_ChainId vl_before2ChainId2 := f_EPTF_NQueue_createChain(vl_queueBefore);
vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueBefore, vl_before2ChainId);
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retHead := f_EPTF_NQueue_createItemBefore(vl_queueBefore, vl_retHead);
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueBefore, vl_before2ChainId, c_reversedOrder, "createItemBefore basic error");
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainHead1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainHead is called on a queue with no chain, error should be seen.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainHead1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
var EPTF_NQueue_ItemIdx vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueId, vl_fakeChainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainHead2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainHead is called without a queue and no chain, error should be seen.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainHead2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_fakeQueueId := 0; //no queue will be crated
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
var EPTF_NQueue_ItemIdx vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_fakeQueueId, vl_fakeChainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainHead3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainHead is called with a wrong queue and a good chain, error should be seen.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainHead3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_fakeQueueId := vl_queueId+1;
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
var EPTF_NQueue_ItemIdx vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_fakeQueueId, vl_chainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainHead4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainHead is called with a wrong chain id that exist in another queue, error should be seen.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainHead4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueId2 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ChainId vl_chainId3 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ItemIdx vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueId1, vl_chainId3);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainHead is called with a wrong chain id, error should be seen.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
f_EPTF_NQueue_createItemsAtChainHead(vl_queueId, vl_fakeChainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainHead is called with a wrong queue id and wrong chain id. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_fakeQueueId := 0; //no queue will be crated
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
f_EPTF_NQueue_createItemsAtChainHead(vl_fakeQueueId, vl_fakeChainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainHead is called with a wrong queue id with a good chain id given. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_fakeQueueId := vl_queueId+1;
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
f_EPTF_NQueue_createItemsAtChainHead(vl_fakeQueueId, vl_chainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainHead.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainHead is called with a wrong chain id that exist in another queue. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueId2 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ChainId vl_chainId3 := f_EPTF_NQueue_createChain(vl_queueId2);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueId1, vl_chainId3, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainTail1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainTail is called with a wrong chain id. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainTail1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
var EPTF_NQueue_ItemIdx vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_queueId, vl_fakeChainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainTail2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainTail.
//
// Requirement:
// -
//
//
// Action:
// f_EPTF_NQueue_createItemAtChainTail is called with a wrong queue id and wrong chain id. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainTail2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_fakeQueueId := 0; //no queue will be crated
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
var EPTF_NQueue_ItemIdx vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_fakeQueueId, vl_fakeChainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainTail3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainTail is called with a wrong queue id with a good chain id given. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainTail3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_fakeQueueId := vl_queueId+1;
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
var EPTF_NQueue_ItemIdx vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_fakeQueueId, vl_chainId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAtChainTail4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAtChainTail is called with a wrong chain id that exist in another queue. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAtChainTail4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueId2 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ChainId vl_chainId3 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ItemIdx vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId3);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainTail
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainTail is called with a wrong chain id. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
f_EPTF_NQueue_createItemsAtChainTail(vl_queueId, vl_fakeChainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainTail is called with a wrong queue id and wrong chain id. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_fakeQueueId := 0; //no queue will be crated
var EPTF_NQueue_ChainId vl_fakeChainId := 0; //no chain will be crated
f_EPTF_NQueue_createItemsAtChainTail(vl_fakeQueueId, vl_fakeChainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainTail is called with a wrong queue id with a good chain id given. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_fakeQueueId := vl_queueId+1;
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
f_EPTF_NQueue_createItemsAtChainTail(vl_fakeQueueId, vl_chainId, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemsAtChainTail.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemsAtChainTail is called with a wrong chain id that exist in another queue. It should report error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong chain id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueId2 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueId2);
var EPTF_NQueue_ChainId vl_chainId3 := f_EPTF_NQueue_createChain(vl_queueId2);
f_EPTF_NQueue_createItemsAtChainTail(vl_queueId1, vl_chainId3, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAfter1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAfter.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAfter is called with a wrong queue id. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAfter1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemAfter(vl_queueId1 + 10, 0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAfter2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAfter.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAfter is called with a wrong item id. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAfter2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemAfter(vl_queueId1, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAfter3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAfter.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAfter is called for an empty queue. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAfter3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAfter(vl_queueId1, 0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemAfter4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemAfter.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemAfter is called with item index -1. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemAfter4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemAfter(vl_queueId1, -1);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemBefore1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemBefore.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemBefore is called with a wrong queue id. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong queue id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemBefore1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemBefore(vl_queueId1 + 10, 0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemBefore2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemBefore.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemBefore is called with a wrong item id. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemBefore2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemBefore(vl_queueId1, c_maxChainSize);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemBefore3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemBefore.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemBefore is called for an empty queue. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemBefore3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemBefore(vl_queueId1, 0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_createItemBefore4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_createItemBefore.
//
// Requirement:
// -
//
// Action:
// f_EPTF_NQueue_createItemBefore is called with item index -1. It should report an error.
//
// Expected result:
// Test passes if the function above works correctly and reports error for a wrong item id.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createItemBefore4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId1 := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId1);
f_EPTF_NQueue_createItemAtChainTail(vl_queueId1, vl_chainId1);
f_EPTF_NQueue_createItemBefore(vl_queueId1, -1);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToHead
//
// Purpose:
// This test checks the f_EPTF_NQueue_moveToHead function.
//
// Requirement:
// -
//
// Action:
// A queue is created with a chain, and into the chain c_maxChainSize items are created.
// After that we move items with f_EPTF_NQueue_moveToHead into different orders and check the results.
//
// Expected result:
// Test passes if the function above works correctly and the order of the items in chain is correct.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToHead() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queueMHead := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_head2ChainId := f_EPTF_NQueue_createChain(vl_queueMHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_head2ChainId, c_maxChainSize );
//Let's move only the last(0) element in chain to head
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, 0)
// Now it should contain 0,4,3,2,1 (assumed c_maxChainSize is the default 5), lets check the first one.
var EPTF_NQueue_ItemIdx vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_head2ChainId);
if(0 != vl_nextIdx){setverdict(fail, "moveToHead - Head index of chain is not 0 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
// Now move all others to front. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, vl_i)
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_head2ChainId, c_reversedOrder, "moveToHead basic error");
//Now we do a little hack: move the tail of the list to head, does it work?
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_head2ChainId) )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_head2ChainId);
if(0 != vl_nextIdx){setverdict(fail, "moveToHead with getTailOfChain - Head index of chain is not 0 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
// Now move all others to front. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_head2ChainId))
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_head2ChainId, c_reversedOrder, "moveToHead(getTailOfChain) error");
//What happens when we move the head from the head - so it should stay
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, c_maxChainSize-1 )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_head2ChainId);
if(c_maxChainSize-1 != vl_nextIdx){setverdict(fail, "moveToHead when moving head to head - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize-1))}
//The same case but with getHeadOfChain function
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_head2ChainId) )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_head2ChainId);
if(c_maxChainSize-1 != vl_nextIdx){setverdict(fail, "moveToHead when moving head to head - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize-1))}
// moveToHead from the inside of the chain. The even ones are moved first, after that the odds, so at the end
// the list will look like : 3,1,4,2,0
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, vl_i )
}
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_head2ChainId, vl_i )
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_head2ChainId, c_scatteredOrder, "moveToHead from the inside of the chain error");
//move an item to the head of a chain and then move it again immediately to a head of another chain
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ItemIdx vl_itemToMove := 0;
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_chainId1, vl_itemToMove);
f_EPTF_NQueue_moveToHead(vl_queueMHead, vl_chainId2, vl_itemToMove);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId1);
if (-1 != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: -1, received: "&log2str(vl_itemIdx) );
}
vl_itemIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId2);
if (vl_itemToMove != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: "&log2str(vl_itemToMove)&", received: "&log2str(vl_itemIdx) );
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveToTail
//
// Purpose:
// This test checks the f_EPTF_NQueue_moveToTail function.
//
// Requirement:
// -
//
// Action:
// A queue is created with a chain, and into the chain c_maxChainSize items are created.
// After that we move items with f_EPTF_NQueue_moveToTail into different orders and check the results.
//
// Expected result:
// Test passes if the function above works correctly and the order of the items in chain is correct.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveToTail() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queueMHead := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueMHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_chainId, c_maxChainSize );
//Let's move only the first(c_maxChainSize) element in chain to tail
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, c_maxChainSize-1)
// Now it should contain 3,2,1,0,4 (assumed c_maxChainSize is the default 5), lets check the first one.
var EPTF_NQueue_ItemIdx vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 2 != vl_nextIdx){setverdict(fail, "moveToTail - Head index of chain is not c_maxChainSize - 2 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 2))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveToTail - Tail index of chain is not c_maxChainSize - 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// Now move all others to back. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := c_maxChainSize-2; vl_i >= 0 ; vl_i := vl_i-1 )
{
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, vl_i)
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_chainId, c_reversedOrder, "moveToTail basic error");
//Now we do a little hack: move the head of the list to tail, does it work?
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 2 != vl_nextIdx){setverdict(fail, "moveToTail with getTailOfChain - Head index of chain is not c_maxChainSize - 2 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 2))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveToTail with getTailOfChain - Tail index of chain is not c_maxChainSize - 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// Now move all others to back. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := c_maxChainSize-2; vl_i >= 0 ; vl_i := vl_i-1 )
{
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId))
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_chainId, c_reversedOrder, "moveToTail(getHeadOfChain) error");
//What happens when we move the tail from the tail - so it should stay
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, 0 )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveToTail when moving tail to tail - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveToTail when moving tail to tail - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
//The same case but with getTailOfChain function
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveToTail when moving tail to tail with getTailOfChain - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queueMHead, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveToTail when moving tail to tail with getTailOfChain - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// moveToTail from the inside of the chain. The odd ones are moved first, after that the evens, so at the end
// the list will look like : 1,3,0,2,4
for ( var integer vl_i := 1; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, vl_i )
}
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId, vl_i )
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_chainId, c_scattered2Order, "moveToTail from the inside of the chain error");
//move an item to the tail of a chain and then move it again immediately to a tail of another chain
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ItemIdx vl_itemToMove := 0;
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId1, vl_itemToMove);
f_EPTF_NQueue_moveToTail(vl_queueMHead, vl_chainId2, vl_itemToMove);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId1);
if (-1 != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: -1, received: "&log2str(vl_itemIdx) );
}
vl_itemIdx := f_EPTF_NQueue_getTailOfChain(vl_queueMHead, vl_chainId2);
if (vl_itemToMove != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: "&log2str(vl_itemToMove)&", received: "&log2str(vl_itemIdx) );
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveAfter
//
// Purpose:
// This test checks the f_EPTF_NQueue_moveAfter function.
//
// Requirement:
// -
//
// Action:
// A queue is created with a chain, and into the chain c_maxChainSize items are created.
// After that we move items with f_EPTF_NQueue_moveAfter into different orders and check the results.
//
// Expected result:
// Test passes if the function above works correctly and the order of the items in chain is correct.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveAfter() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
//Let's move only the first(c_maxChainSize) element in chain to the tail ( after element 0 )
f_EPTF_NQueue_moveAfter(vl_queue, 0, c_maxChainSize-1)
// Now it should contain 3,2,1,0,4 (assumed c_maxChainSize is the default 5), lets check the first one.
var EPTF_NQueue_ItemIdx vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 2 != vl_nextIdx){setverdict(fail, "moveAfter - Head index of chain is not c_maxChainSize - 2 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 2))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveAfter - Tail index of chain is not c_maxChainSize - 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// Now move all others to back. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := c_maxChainSize-2; vl_i >= 0 ; vl_i := vl_i-1 )
{
f_EPTF_NQueue_moveAfter(vl_queue, vl_i + 1, vl_i)
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_reversedOrder, "moveAfter basic error");
//Now we do a little hack: move the head of the list to tail, does it work?
f_EPTF_NQueue_moveAfter(vl_queue, 0, f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 2 != vl_nextIdx){setverdict(fail, "moveAfter with getTailOfChain - Head index of chain is not c_maxChainSize - 2 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 2))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveAfter with getTailOfChain - Tail index of chain is not c_maxChainSize - 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// Now move all others to back. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := c_maxChainSize-1; vl_i > 0 ; vl_i := vl_i-1 )
{
f_EPTF_NQueue_moveAfter(vl_queue, vl_i, f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId))
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_reversedOrder, "moveAfter(getHeadOfChain) error");
//What happens when we move item after itself - it should stay
f_EPTF_NQueue_moveAfter(vl_queue, 0, 0 )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveAfter when moving tail to tail - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveAfter when moving tail to tail - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
//The same case but with getTailOfChain function
f_EPTF_NQueue_moveAfter(vl_queue, 0, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveAfter when moving tail to tail with getTailOfChain - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveAfter when moving tail to tail with getTailOfChain - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// moveAfter from the inside of the chain. The odd ones are moved first, after that the evens, so at the end
// the list will look like : c_scattered2Order := {1,3,0,2,4}
for ( var integer vl_i := 3; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveAfter(vl_queue, vl_i - 2, vl_i )
}
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId, 0 )
for ( var integer vl_i := 2; vl_i < c_maxChainSize; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveAfter(vl_queue, vl_i - 2, vl_i )
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_scattered2Order, "moveAfter from the inside of the chain error");
//move an item to the tail of a chain and then move it again immediately to a tail of another chain
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ItemIdx vl_first := f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId1);
var EPTF_NQueue_ItemIdx vl_second := f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId2);
var EPTF_NQueue_ItemIdx vl_itemToMove := 0;
f_EPTF_NQueue_moveAfter(vl_queue, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId1), vl_itemToMove);
f_EPTF_NQueue_moveAfter(vl_queue, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId2), vl_itemToMove);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId1);
if (vl_first != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: " & log2str(vl_first) & ", received: "&log2str(vl_itemIdx) );
}
vl_itemIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId2);
if (vl_itemToMove != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: "&log2str(vl_itemToMove)&", received: "&log2str(vl_itemIdx) );
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_moveBefore
//
// Purpose:
// This test checks the f_EPTF_NQueue_moveBefore function.
//
// Requirement:
// -
//
// Action:
// A queue is created with a chain, and into the chain c_maxChainSize items are created.
// After that we move items with f_EPTF_NQueue_moveBefore into different orders and check the results.
//
// Expected result:
// Test passes if the function above works correctly and the order of the items in chain is correct.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_moveBefore() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
//Let's move only the last(0) element in chain to the head ( Before element c_maxChainSize - 1 )
f_EPTF_NQueue_moveBefore(vl_queue, c_maxChainSize-1, 0)
// Now it should contain 0,4,3,2,1 (assumed c_maxChainSize is the default 5), lets check the first one.
var EPTF_NQueue_ItemIdx vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveBefore - Head index of chain is not 0 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(1 != vl_nextIdx){setverdict(fail, "moveBefore - Tail index of chain is not 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(1))}
// Now move all others to front. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := 0; vl_i < c_maxChainSize - 1; vl_i := vl_i+1 )
{
f_EPTF_NQueue_moveBefore(vl_queue, vl_i, vl_i + 1)
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_reversedOrder, "moveBefore basic error");
//Now we do a little hack: move the head of the list to tail, does it work?
f_EPTF_NQueue_moveBefore(vl_queue, c_maxChainSize - 1, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveBefore with getTailOfChain - Head index of chain is not 0 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(1 != vl_nextIdx){setverdict(fail, "moveBefore with getTailOfChain - Tail index of chain is not 1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(1))}
// Now move all others to back. At the end we should get the original order : 4,3,2,1,0
for ( var integer vl_i := 0; vl_i < c_maxChainSize - 1; vl_i := vl_i+1 )
{
f_EPTF_NQueue_moveBefore(vl_queue, vl_i, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId))
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_reversedOrder, "moveBefore(getHeadOfChain) error");
//What happens when we move item Before itself - it should stay
f_EPTF_NQueue_moveBefore(vl_queue, 0, 0 )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveBefore when moving tail to tail - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveBefore when moving tail to tail - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
//The same case but with getTailOfChain function
f_EPTF_NQueue_moveBefore(vl_queue, 0, f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId) )
vl_nextIdx := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if(0 != vl_nextIdx){setverdict(fail, "moveBefore when moving tail to tail with getTailOfChain - Tail index of chain is not 0 -- TailIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(0))}
vl_nextIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if(c_maxChainSize - 1 != vl_nextIdx){setverdict(fail, "moveBefore when moving tail to tail with getTailOfChain - Head index of chain is not c_maxChainSize-1 -- HeadIdx:" & int2str(vl_nextIdx) & " Max:" &int2str(c_maxChainSize - 1))}
// moveBefore from the inside of the chain. The odd ones are moved first, Before that the evens, so at the end
// the list will look like : c_scatteredOrder := {3,1,4,2,0}
for ( var integer vl_i := 3; vl_i < c_maxChainSize ; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveBefore(vl_queue, vl_i - 2, vl_i )
}
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId, 0 )
for ( var integer vl_i := 2; vl_i < c_maxChainSize; vl_i := vl_i + 2 )
{
f_EPTF_NQueue_moveBefore(vl_queue, vl_i - 2, vl_i )
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queue, vl_chainId, c_scatteredOrder, "moveBefore from the inside of the chain error");
//move an item to the tail of a chain and then move it again immediately to a tail of another chain
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ItemIdx vl_first := f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId1);
var EPTF_NQueue_ItemIdx vl_second := f_EPTF_NQueue_createItemAtChainHead(vl_queue, vl_chainId2);
var EPTF_NQueue_ItemIdx vl_itemToMove := 0;
f_EPTF_NQueue_moveBefore(vl_queue, f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId1), vl_itemToMove);
f_EPTF_NQueue_moveBefore(vl_queue, f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId2), vl_itemToMove);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId1);
if (vl_first != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: " & log2str(vl_first) & ", received: "&log2str(vl_itemIdx) );
}
vl_itemIdx := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId2);
if (vl_itemToMove != vl_itemIdx){
setverdict ( fail, "Wrong item index was received! expected: "&log2str(vl_itemToMove)&", received: "&log2str(vl_itemIdx) );
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Debug
//
// Purpose:
// Manual test for the NQueue debug feature
//
// Requirement:
// Set the EPTF_NQUEUE_DEBUG or EPTF_DEBUG compiler flag in the makefile!
// Set the tsp_CLL_debug_acceptableMaxSizeOfGrowingVariables and tsp_CLL_debug_increasePercentage4AcceptableMaxSize module parameters in the configuration file!
//
// Action:
// A queue, 1000 chains within it and 789 item in the last chain is created. At the end it logs the contents of the queue.
//
// Expected result:
// In the log file, there should be some warning messages about exceeding and increasing the maximum chain count and maximum item count in the queue and in the chain.
// The number of warning messages depends on the values of the above mentioned module parameters.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Debug() runs on EPTF_NQueue_Test_CT
{
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var integer vl_i;
var EPTF_NQueue_ChainId vl_chainId;
for(vl_i := 0; vl_i < 1000; vl_i := vl_i +1)
{
vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
}
f_EPTF_NQueue_createItemsAtChainHead(vl_queueId, vl_chainId, 789);
f_EPTF_NQueue_logQueue(vl_queueId);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToHead1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToHead.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it. Try to move a wrong item with id "-1"
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToHead1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the -1 element of queue, so the next line should fail
f_EPTF_NQueue_moveToHead(vl_queue, vl_chainId, -1 )
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToHead2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToHead.
//
// Requirement:
// -
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it. Try to move a wrong item with id <c_maxChainSize>
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToHead2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element after the last element of queue, so the next line should fail
f_EPTF_NQueue_moveToHead(vl_queue, vl_chainId, c_maxChainSize)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToHead3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToHead.
//
// Requirement:
// -
// Action:
// A queue with a chain is created, and no items in it. Try to move a wrong item with id "0"
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToHead3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
// Try to move the 0 element of an empty queue, so the next line should fail
f_EPTF_NQueue_moveToHead(vl_queue, vl_chainId, 0)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToHead4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToHead.
//
// Requirement:
// -
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong queue id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToHead4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a not existing queue, so the next line should fail
f_EPTF_NQueue_moveToHead(vl_queue+10, vl_chainId, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToHead5
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToHead.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong chain id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToHead5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a queue, with an invalid chain, so the next line should fail
f_EPTF_NQueue_moveToHead(vl_queue, vl_chainId+10, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToTail1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToTail.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id "-1".
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
/////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToTail1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainTail(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the -1 element of queue, so the next line should fail
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId, -1 )
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToTail2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToTail.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize>.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToTail2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainTail(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element after the last element of queue, so the next line should fail
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId, c_maxChainSize)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToTail3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToTail.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and no items in it.
// Try to move an item with id "0" in an empty chain.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToTail3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
// Try to move the 0 element of an empty queue, so the next line should fail
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId, 0)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToTail4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToTail.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong queue id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToTail4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainTail(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a not existing queue, so the next line should fail
f_EPTF_NQueue_moveToTail(vl_queue+10, vl_chainId, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveToTail5
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveToTail.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong chain id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveToTail5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainTail(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a queue, with an invalid chain, so the next line should fail
f_EPTF_NQueue_moveToTail(vl_queue, vl_chainId+10, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveAfter1
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveAfter.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id "-1".
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveAfter1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the -1 element of queue, so the next line should fail
f_EPTF_NQueue_moveAfter(vl_queue, 0, -1 )
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveAfter2
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveAfter.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize>.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveAfter2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element after the last element of queue, so the next line should fail
f_EPTF_NQueue_moveAfter(vl_queue, 0, c_maxChainSize)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveAfter3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveAfter.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and no items in it.
// Try to move an item with id "0" in an empty chain.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveAfter3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
// Try to move the 0 element of an empty queue, so the next line should fail
f_EPTF_NQueue_moveAfter(vl_queue, 0, 0)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveAfter4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveAfter.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong queue id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveAfter4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a not existing queue, so the next line should fail
f_EPTF_NQueue_moveAfter(vl_queue+10, 0, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveAfter5
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveAfter.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> after a non-existent item index.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveAfter5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a queue, with an invalid item to move after, so the next line should fail
f_EPTF_NQueue_moveAfter(vl_queue, c_maxChainSize, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveBefore1
//
// Purpose: This is a negative test.
// This test checks the f_EPTF_NQueue_moveBefore.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id "-1".
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveBefore1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the -1 element of queue, so the next line should fail
f_EPTF_NQueue_moveBefore(vl_queue, 0, -1 )
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveBefore2
//
// Purpose: This is a negative test.
// This test checks the f_EPTF_NQueue_moveBefore.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize>.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveBefore2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element Before the last element of queue, so the next line should fail
f_EPTF_NQueue_moveBefore(vl_queue, 0, c_maxChainSize)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveBefore3
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveBefore.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and no items in it.
// Try to move an item with id "0" in an empty chain.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveBefore3() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
// Try to move the 0 element of an empty queue, so the next line should fail
f_EPTF_NQueue_moveBefore(vl_queue, 0, 0)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveBefore4
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveBefore.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> with a wrong queue id.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveBefore4() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a not existing queue, so the next line should fail
f_EPTF_NQueue_moveBefore(vl_queue+10, 0, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////
// Testcase: tc_EPTF_NQueue_Test_Neg_moveBefore5
//
// Purpose:
// This is a negative test.
// This test checks the f_EPTF_NQueue_moveBefore.
//
// Requirement:
// -
//
// Action:
// A queue with a chain is created, and <c_maxChainSize> items in it.
// Try to move an item with id <c_maxChainSize-1> before a non-existent item index.
//
// Expected result:
// Test passes if the correct error message appears, which is the expected behavior.
//
///////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_moveBefore5() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid item*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// Try to move the element of a queue, with an invalid item to move Before, so the next line should fail
f_EPTF_NQueue_moveBefore(vl_queue, c_maxChainSize, c_maxChainSize-1)
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_getFunctionsBasic
//
// Purpose:
// This test checks the following functions:
// f_EPTF_NQueue_getChainOfItem, f_EPTF_NQueue_getLengthOfQueue
// f_EPTF_NQueue_getLengthOfChain, f_EPTF_NQueue_getHeadOfChain
// f_EPTF_NQueue_getTailOfChain, f_EPTF_NQueue_getNextItemIdx
// f_EPTF_NQueue_getPrevItemIdx.
//
// Requirement:
// -
//
// Action:
// An empty queue with two empty chains are created, the first one is only
// for placeholder.
// First the head and the tail of the second chain is queried and -1 is expected
// as result for both.
// Then <c_maxChainSize> items are created in the second chain.
// After that the second chain id of the tail is queried and it should be equal
// with the second one that was created.
// Next the lenght of the queue and the length of the second chain is checked,
// both should be equal with <c_maxChainSize>.
// Then the head and the tail is queried followed by 6 tests that checks
// the Next and Previous indexes of a valid item.
//
// Expected result:
// Final verdict should be pass.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getFunctionsBasic() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
vl_chainId := f_EPTF_NQueue_createChain(vl_queue);
var EPTF_NQueue_ItemIdx vl_headReturned := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if (-1 != vl_headReturned){
setverdict(fail, "f_EPTF_NQueue_getHeadOfChain returns wrong head item index when the chain is empty! expected: "&log2str(-1)&", returned:"&log2str(vl_headReturned));
}
var EPTF_NQueue_ItemIdx vl_tailReturned := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if (-1 != vl_tailReturned){
setverdict(fail, "f_EPTF_NQueue_getTailOfChain returns wrong head item index when the chain is empty! expected: "&log2str(-1)&", returned:"&log2str(vl_tailReturned));
}
var integer vl_lengthOfQReturned := f_EPTF_NQueue_getLengthOfQueue(vl_queue);
if (0 != vl_lengthOfQReturned){
setverdict(fail, "f_EPTF_NQueue_getLengthOfQueue returns wrong queue length! expected: "&log2str(0)&", returned:"&log2str(vl_lengthOfQReturned));
}
var integer vl_lengthOfCReturned := f_EPTF_NQueue_getLengthOfChain(vl_queue, vl_chainId);
if (0 != vl_lengthOfCReturned){
setverdict(fail, "f_EPTF_NQueue_getLengthOfChain returns wrong queue length! expected: "&log2str(0)&", returned:"&log2str(vl_lengthOfCReturned));
}
f_EPTF_NQueue_createItemsAtChainHead(vl_queue, vl_chainId, c_maxChainSize );
// {4,3,2,1,0}
var EPTF_NQueue_ChainId vl_chainIdReturned := f_EPTF_NQueue_getChainOfItem(vl_queue, 0);
if (vl_chainId != vl_chainIdReturned){
setverdict(fail, "f_EPTF_NQueue_getChainOfItem returns wrong chain id! expected: "&log2str(vl_chainId)&", returned:"&log2str(vl_chainIdReturned));
}
vl_lengthOfQReturned := f_EPTF_NQueue_getLengthOfQueue(vl_queue);
if (c_maxChainSize != vl_lengthOfQReturned){
setverdict(fail, "f_EPTF_NQueue_getLengthOfQueue returns wrong queue length! expected: "&log2str(c_maxChainSize)&", returned:"&log2str(vl_lengthOfQReturned));
}
vl_lengthOfCReturned := f_EPTF_NQueue_getLengthOfChain(vl_queue, vl_chainId);
if (c_maxChainSize != vl_lengthOfCReturned){
setverdict(fail, "f_EPTF_NQueue_getLengthOfChain returns wrong chain length! expected: "&log2str(c_maxChainSize)&", returned:"&log2str(vl_lengthOfCReturned));
}
vl_headReturned := f_EPTF_NQueue_getHeadOfChain(vl_queue, vl_chainId);
if (c_maxChainSize-1 != vl_headReturned){
setverdict(fail, "f_EPTF_NQueue_getHeadOfChain returns wrong head item index! expected: "&log2str(c_maxChainSize-1)&", returned:"&log2str(vl_headReturned));
}
vl_tailReturned := f_EPTF_NQueue_getTailOfChain(vl_queue, vl_chainId);
if (0 != vl_tailReturned){
setverdict(fail, "f_EPTF_NQueue_getTailOfChain returns wrong head item index! expected: "&log2str(0)&", returned:"&log2str(vl_tailReturned));
}
var EPTF_NQueue_ItemIdx vl_testItemId1 := c_maxChainSize-1;
var boolean vl_nextItemSuccess := f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemId1);
if (not vl_nextItemSuccess){
setverdict(fail, "f_EPTF_NQueue_getNextItemIdx returns false, but true was expected!");
}
if (vl_testItemId1 != c_maxChainSize-2){
setverdict(fail, "f_EPTF_NQueue_getNextItemIdx gets wrong next item! expected: "&log2str(c_maxChainSize-2)&", returned:"&log2str(vl_testItemId1));
}
var EPTF_NQueue_ItemIdx vl_testItemId2 := 0;
var boolean vl_prevItemSuccess := f_EPTF_NQueue_getPrevItemIdx(vl_queue, vl_testItemId2);
if (not vl_prevItemSuccess){
setverdict(fail, "f_EPTF_NQueue_getPrevItemIdx returns false, but true was expected!");
}
if (vl_testItemId2 != 1){
setverdict(fail, "f_EPTF_NQueue_getNextItemIdx gets wrong next item! expected: "&log2str(1)&", returned:"&log2str(vl_testItemId2));
}
vl_testItemId1 := 0;
vl_nextItemSuccess := f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemId1);
if (vl_nextItemSuccess){
setverdict(fail, "f_EPTF_NQueue_getNextItemIdx returns true, but false was expected, because the given item hasn't got a next item!");
}
vl_testItemId2 := c_maxChainSize-1;
vl_prevItemSuccess := f_EPTF_NQueue_getPrevItemIdx(vl_queue, vl_testItemId2);
if (vl_prevItemSuccess){
setverdict(fail, "f_EPTF_NQueue_getPrevItemIdx returns true, but false was expected, because the given item hasn't got a previous item!");
}
var EPTF_NQueue_ItemIdx vl_testItemIdBasic := c_maxChainSize-3;
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemIdBasic);
var EPTF_NQueue_ItemIdx vl_testItemIdSaved := vl_testItemIdBasic;
vl_testItemIdBasic := c_maxChainSize-3;
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemIdBasic);
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemIdBasic);
f_EPTF_NQueue_getPrevItemIdx(vl_queue, vl_testItemIdBasic);
if (vl_testItemIdBasic != vl_testItemIdSaved) {
setverdict ( fail, "These two items should be equal: item1: "&log2str(vl_testItemIdBasic)&", item2: "&log2str(vl_testItemIdSaved));
}
vl_testItemIdBasic := c_maxChainSize-3;
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemIdBasic);
f_EPTF_NQueue_getPrevItemIdx(vl_queue, vl_testItemIdBasic);
vl_testItemIdSaved := vl_testItemIdBasic;
vl_testItemIdBasic := c_maxChainSize-3;
f_EPTF_NQueue_getPrevItemIdx(vl_queue, vl_testItemIdBasic);
f_EPTF_NQueue_getNextItemIdx(vl_queue, vl_testItemIdBasic);
if (vl_testItemIdBasic != vl_testItemIdSaved) {
setverdict ( fail, "These two items should be equal: item1: "&log2str(vl_testItemIdBasic)&", item2: "&log2str(vl_testItemIdSaved));
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_getHeadAndTailWithOneLengthChain
//
// Purpose:
// This test checks the following functions:
// <f_EPTF_NQueue_getHeadOfChain>, <f_EPTF_NQueue_getTailOfChain>
//
// Requirement:
// -
//
// Action:
// A queue with two chains(the first is just a placeholder)and one item in the second chain are created.
// These two functions should return the same item index because there
// is only one item in the second chain:
// <f_EPTF_NQueue_getHeadOfChain>
// <f_EPTF_NQueue_getTailOfChain>
// The same result is expected when a new item is added to the chain and then
// this item is moved to another chain.
//
// Expected result:
// Tc should be pass if the above functions work correctly.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getHeadAndTailWithOneLengthChain() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
vl_chainId := f_EPTF_NQueue_createChain(vl_queueId);
var EPTF_NQueue_ItemIdx vl_itemIdx := f_EPTF_NQueue_createItemAtChainTail(vl_queueId, vl_chainId);
var EPTF_NQueue_ItemIdx vl_idxOfHead := f_EPTF_NQueue_getHeadOfChain(vl_queueId, vl_chainId);
var EPTF_NQueue_ItemIdx vl_idxOfTail := f_EPTF_NQueue_getTailOfChain(vl_queueId, vl_chainId);
if ((vl_itemIdx != vl_idxOfHead) or (vl_itemIdx != vl_idxOfTail)){
setverdict(fail, "There was a problem, these three items should be the same: "&
log2str(vl_itemIdx)&", "&log2str(vl_idxOfHead)&", "&log2str(vl_idxOfTail)&".");
}
var EPTF_NQueue_ChainId vl_tempChainId := f_EPTF_NQueue_createChain(vl_queueId);
f_EPTF_NQueue_moveToHead(vl_queueId, vl_tempChainId, f_EPTF_NQueue_createItemAtChainTail(vl_queueId, vl_chainId));
vl_idxOfHead := f_EPTF_NQueue_getHeadOfChain(vl_queueId, vl_chainId);
vl_idxOfTail := f_EPTF_NQueue_getTailOfChain(vl_queueId, vl_chainId);
if ((vl_itemIdx != vl_idxOfHead) or (vl_itemIdx != vl_idxOfTail)){
setverdict(fail, "There was a problem, these three items should be the same: "&
log2str(vl_itemIdx)&", "&log2str(vl_idxOfHead)&", "&log2str(vl_idxOfTail)&".");
}
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_getFunctionsWithEmptiedChain
//
// Purpose:
// This test checks if the get functions are working properly with an
// emptied chain.
//
// Requirement:
// -
//
// Actions:
// First a queue with 3 chains is created. The first chain is filled with
// <c_maxChainSize> items, the second and third chain is empty. All the items are
// moved from the first chain into the third chain and then the possible
// getter functions are tested.
//
// Expected result:
// All getter functions should return correct values.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_getFunctionsWithEmptiedChain() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
setverdict(pass);
var EPTF_NQueue_QueueId vl_queueId := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_ChainId vl_chainId1 := f_EPTF_NQueue_createChain(vl_queueId);
var EPTF_NQueue_ChainId vl_chainId2 := f_EPTF_NQueue_createChain(vl_queueId);
var EPTF_NQueue_ChainId vl_chainId3 := f_EPTF_NQueue_createChain(vl_queueId);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueId, vl_chainId1, c_maxChainSize );
for ( var integer i := 0; i < c_maxChainSize ; i := i+1 )
{
f_EPTF_NQueue_moveToHead(vl_queueId, vl_chainId3, f_EPTF_NQueue_getHeadOfChain(vl_queueId, vl_chainId1));
}
if (c_maxChainSize != f_EPTF_NQueue_getLengthOfQueue(vl_queueId)){
setverdict(fail, "Length of queue changed while moving some items from a chain to another chain.");
}
if (0 != f_EPTF_NQueue_getLengthOfChain(vl_queueId, vl_chainId1)){
setverdict(fail, "Length of source chain is wrong after moving some items.");
}
if (c_maxChainSize != f_EPTF_NQueue_getLengthOfChain(vl_queueId, vl_chainId3)){
setverdict(fail, "Length of target chain is wrong after moving some items.");
}
if (0 != f_EPTF_NQueue_getLengthOfChain(vl_queueId, vl_chainId2)){
setverdict(fail, "Length of untouched chain is wrong after moving some items between two other chains.");
}
if(-1 != f_EPTF_NQueue_getHeadOfChain(vl_queueId, vl_chainId1)){
setverdict(fail, "An empty chain should not have a head item!");
}
if(-1 != f_EPTF_NQueue_getTailOfChain(vl_queueId, vl_chainId1)){
setverdict(fail, "An empty chain should not have a tail item!");
}
f_EPTF_Base_stop(none);
}
const EPTF_IntegerList c_order2 := {6,7,8,9,10}
const EPTF_IntegerList c_reversedOrder2 := {10,9,8,7,6}
const EPTF_IntegerList c_burstOrder2 := {6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
const EPTF_IntegerList c_burstReversedOrder2 := {20,19,18,17,16,15,14,13,12,11,10,9,8,7,6}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_createItemFunctionsWith3Chains
//
// Purpose:
// This test checks the f_EPTF_NQueue_createItemAtChainHead, f_EPTF_NQueue_createItemAtChainTail,
// f_EPTF_NQueue_createItemsAtChainHead, f_EPTF_NQueue_createItemsAtChainTail functions.
//
// Requirement:
// -
//
// Actions:
// 4 queue is created with 3 chain on each, and into the chains items are created with the different
// functions. The order of the chains is checked after each createItem function.
//
// Expected result:
// Tc should be pass if the above functions work correctly.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_createItemFunctionsWith3Chains() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
var EPTF_NQueue_QueueId vl_queueHead := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueTail := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueMHead := f_EPTF_NQueue_createQueue();
var EPTF_NQueue_QueueId vl_queueMTail := f_EPTF_NQueue_createQueue();
setverdict(pass);
//f_EPTF_NQueue_createItemAtChainHead test
var EPTF_NQueue_ChainId vl_placeHolder1 := f_EPTF_NQueue_createChain(vl_queueHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueHead, vl_placeHolder1, c_maxBurstSize );
vl_placeHolder1 := f_EPTF_NQueue_createChain(vl_queueTail);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueTail, vl_placeHolder1, c_maxBurstSize );
vl_placeHolder1 := f_EPTF_NQueue_createChain(vl_queueMHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_placeHolder1, c_maxBurstSize );
vl_placeHolder1 := f_EPTF_NQueue_createChain(vl_queueMTail);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMTail, vl_placeHolder1, c_maxBurstSize );
var EPTF_NQueue_ChainId vl_headChainId := f_EPTF_NQueue_createChain(vl_queueHead);
var EPTF_NQueue_ChainId vl_tailChainId := f_EPTF_NQueue_createChain(vl_queueTail);
var EPTF_NQueue_ChainId vl_head2ChainId := f_EPTF_NQueue_createChain(vl_queueMHead);
var EPTF_NQueue_ChainId vl_tail2ChainId := f_EPTF_NQueue_createChain(vl_queueMTail);
var EPTF_NQueue_ChainId vl_placeHolder2 := f_EPTF_NQueue_createChain(vl_queueHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueHead, vl_placeHolder2, c_maxBurstSize );
vl_placeHolder2 := f_EPTF_NQueue_createChain(vl_queueTail);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueTail, vl_placeHolder2, c_maxBurstSize );
vl_placeHolder2 := f_EPTF_NQueue_createChain(vl_queueMHead);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_placeHolder2, c_maxBurstSize );
vl_placeHolder2 := f_EPTF_NQueue_createChain(vl_queueMTail);
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMTail, vl_placeHolder2, c_maxBurstSize );
var EPTF_NQueue_ItemIdx vl_retHead := 0;
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retHead := f_EPTF_NQueue_createItemAtChainHead(vl_queueHead, vl_headChainId);
if(vl_retHead != vl_i + 2*c_maxBurstSize){ setverdict(fail, "Wrong return value during createItemAtChainHead ret:" & int2str(vl_retHead) & " It should be : " & int2str(vl_i+ 2*c_maxBurstSize) );}
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueHead, vl_headChainId, c_reversedOrder2, "createItemAtChainHead basic error");
//f_EPTF_NQueue_createItemAtChainTail test
var EPTF_NQueue_ItemIdx vl_retTail := 0;
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
vl_retTail := f_EPTF_NQueue_createItemAtChainTail(vl_queueTail, vl_tailChainId);
if(vl_retTail != vl_i+ 2*c_maxBurstSize){ setverdict(fail, "Wrong return value during createItemAtChainTail ret:" & int2str(vl_retTail) & " It should be : " & int2str(vl_i+ 2*c_maxBurstSize) );}
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueTail, vl_tailChainId, c_order2, "createItemAtChainTail basic error");
//f_EPTF_NQueue_createItemsAtChainHead test
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_createItemsAtChainHead(vl_queueMHead, vl_head2ChainId, c_maxBurstSize );
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMHead, vl_head2ChainId, c_burstReversedOrder2, "createItemsAtChainHead basic error");
//f_EPTF_NQueue_createItemsAtChainTail test
for ( var integer vl_i := 0; vl_i < c_maxChainSize ; vl_i := vl_i+1 )
{
f_EPTF_NQueue_createItemsAtChainTail(vl_queueMTail, vl_tail2ChainId, c_maxBurstSize);
}
f_EPTF_NQueue_Test_checkQueueOrder(vl_queueMTail, vl_tail2ChainId, c_burstOrder2, "createItemsAtChainTail basic error");
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_Neg_getLengthFunctions1
//
// Purpose:
// This is a negative test
// This test checks the following function:
// f_EPTF_NQueue_getLengthOfQueue
//
// Requirement:
// -
//
// Action:
// Try to get the length of a non-existent queue.
//
// Expected result:
// Proper error message should appear. Final verdict should be pass.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_getLengthFunctions1() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid queue*")
setverdict(pass);
f_EPTF_NQueue_getLengthOfQueue(0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_Neg_getLengthFunctions2
//
// Purpose:
// This is a negative test
// This test checks the following function:
// f_EPTF_NQueue_getLengthOfChain
//
// Requirement:
// -
//
// Action:
// Try to get the length of a non-existent chain.
//
// Expected result:
// Proper error message should appear. Final verdict should be pass.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_getLengthFunctions2() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue();
setverdict(pass);
f_EPTF_NQueue_getLengthOfChain(vl_queue, 0);
f_EPTF_Base_stop(none);
}
///////////////////////////////////////////////////////////////////////////////
// Testcase:
// tc_EPTF_NQueue_Test_Neg_createQueueWithName
//
// Purpose:
// This is a negative test although it does not test a particular function. If
// the f_EPTF_NQueue_createQueue function is called with a name, when error happens,
// the name of the queue will be in the message. This testcase tests this functionality.
//
// Requirement:
// -
//
// Action:
// 2 queues are created with the name "NewQueueNameIHaveWritten" and "AnotherQueue".
// When asking the length of the non-existent chain of the queue, it will show an error,
// hopefully with the correct queue's name.
//
// Expected result:
// Proper error message should appear. Final verdict should be pass.
///////////////////////////////////////////////////////////////////////////////
testcase tc_EPTF_NQueue_Test_Neg_createQueueWithName() runs on EPTF_NQueue_Test_CT {
f_EPTF_NQueue_init_CT("NQ");
f_EPTF_Base_setExpectedAssertMsg("*invalid chain*number of chains in queue*NewQueueNameIHaveWritten*")
var EPTF_NQueue_QueueId vl_queue := f_EPTF_NQueue_createQueue("NewQueueNameIHaveWritten");
var EPTF_NQueue_QueueId vl_queue2 := f_EPTF_NQueue_createQueue("AnotherQueue");
setverdict(pass);
f_EPTF_NQueue_getLengthOfChain(vl_queue, 0);
f_EPTF_Base_stop(none);
}
control {
execute(tc_EPTF_NQueue_Test_createNewItem1());
execute(tc_EPTF_NQueue_Test_createNewItem2());
execute(tc_EPTF_NQueue_Test_createNewItem3());
execute(tc_EPTF_NQueue_Test_createNewItem4());
execute(tc_EPTF_NQueue_Test_createNewItem5());
execute(tc_EPTF_NQueue_Test_createNewItem6());
execute(tc_EPTF_NQueue_Test_createNewItem7());
execute(tc_EPTF_NQueue_Test_createNewItem9());
execute(tc_EPTF_NQueue_Test_createNewItem10());
execute(tc_EPTF_NQueue_Test_createNewItem11());
execute(tc_EPTF_NQueue_Test_createNewItem12());
execute(tc_EPTF_NQueue_Test_getHeadOfChain());
execute(tc_EPTF_NQueue_Test_getTailOfChain());
execute(tc_EPTF_NQueue_Test_moveToHead1());
execute(tc_EPTF_NQueue_Test_moveToHead2());
execute(tc_EPTF_NQueue_Test_moveToHead3());
execute(tc_EPTF_NQueue_Test_moveToHead4());
execute(tc_EPTF_NQueue_Test_moveToHead5());
execute(tc_EPTF_NQueue_Test_moveToHead6());
execute(tc_EPTF_NQueue_Test_moveToHead7());
execute(tc_EPTF_NQueue_Test_moveToHead8());
execute(tc_EPTF_NQueue_Test_moveToHead9());
execute(tc_EPTF_NQueue_Test_moveToHead10());
execute(tc_EPTF_NQueue_Test_moveToHead11());
execute(tc_EPTF_NQueue_Test_moveToHead12());
execute(tc_EPTF_NQueue_Test_moveToHead13());
execute(tc_EPTF_NQueue_Test_moveToHead14());
execute(tc_EPTF_NQueue_Test_moveToHead15());
execute(tc_EPTF_NQueue_Test_moveToTail1());
execute(tc_EPTF_NQueue_Test_moveToTail2());
execute(tc_EPTF_NQueue_Test_moveToTail3());
execute(tc_EPTF_NQueue_Test_moveToTail4());
execute(tc_EPTF_NQueue_Test_moveToTail5());
execute(tc_EPTF_NQueue_Test_moveToTail6());
execute(tc_EPTF_NQueue_Test_moveToTail7());
execute(tc_EPTF_NQueue_Test_moveToTail8());
execute(tc_EPTF_NQueue_Test_moveToTail9());
execute(tc_EPTF_NQueue_Test_moveToTail10());
execute(tc_EPTF_NQueue_Test_moveToTail11());
execute(tc_EPTF_NQueue_Test_moveToTail12());
execute(tc_EPTF_NQueue_Test_moveToTail13());
execute(tc_EPTF_NQueue_Test_moveToTail14());
execute(tc_EPTF_NQueue_Test_moveToTail15());
execute(tc_EPTF_NQueue_Test_moveAfter1());
execute(tc_EPTF_NQueue_Test_moveAfter2());
execute(tc_EPTF_NQueue_Test_moveAfter3());
execute(tc_EPTF_NQueue_Test_moveAfter4());
execute(tc_EPTF_NQueue_Test_moveAfter5());
execute(tc_EPTF_NQueue_Test_moveAfter6());
execute(tc_EPTF_NQueue_Test_moveAfter7());
execute(tc_EPTF_NQueue_Test_moveAfter8());
execute(tc_EPTF_NQueue_Test_moveAfter9());
execute(tc_EPTF_NQueue_Test_moveAfter10());
execute(tc_EPTF_NQueue_Test_moveAfter11());
execute(tc_EPTF_NQueue_Test_moveAfter12());
execute(tc_EPTF_NQueue_Test_moveBefore1());
execute(tc_EPTF_NQueue_Test_moveBefore2());
execute(tc_EPTF_NQueue_Test_moveBefore3());
execute(tc_EPTF_NQueue_Test_moveBefore4());
execute(tc_EPTF_NQueue_Test_moveBefore5());
execute(tc_EPTF_NQueue_Test_moveBefore6());
execute(tc_EPTF_NQueue_Test_moveBefore7());
execute(tc_EPTF_NQueue_Test_moveBefore8());
execute(tc_EPTF_NQueue_Test_moveBefore9());
execute(tc_EPTF_NQueue_Test_moveBefore10());
execute(tc_EPTF_NQueue_Test_moveBefore11());
execute(tc_EPTF_NQueue_Test_moveBefore12());
execute(tc_EPTF_NQueue_Test_getNextItemIdx());
execute(tc_EPTF_NQueue_Test_getPrevItemIdx());
execute(tc_EPTF_NQueue_Test_getf_EPTF_NQueue_getChainOfItem());
execute(tc_EPTF_NQueue_Test_getLengthOfChain());
execute(tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logQueue());
execute(tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChain());
execute(tc_EPTF_NQueue_Test_getf_EPTF_NQueue_logChainFields());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue1());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue2());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue3());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue4());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue5());
execute(tc_EPTF_NQueue_Test_Neg_deleteQueue6());
execute(tc_EPTF_NQueue_Test_createItemFunctions());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainHead1());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainHead2());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainHead3());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainHead4());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead1());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead2());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead3());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainHead4());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainTail1());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainTail2());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainTail3());
execute(tc_EPTF_NQueue_Test_Neg_createItemAtChainTail4());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail1());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail2());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail3());
execute(tc_EPTF_NQueue_Test_Neg_createItemsAtChainTail4());
execute(tc_EPTF_NQueue_Test_Neg_createItemAfter1());
execute(tc_EPTF_NQueue_Test_Neg_createItemAfter2());
execute(tc_EPTF_NQueue_Test_Neg_createItemAfter3());
execute(tc_EPTF_NQueue_Test_Neg_createItemAfter4());
execute(tc_EPTF_NQueue_Test_Neg_createItemBefore1());
execute(tc_EPTF_NQueue_Test_Neg_createItemBefore2());
execute(tc_EPTF_NQueue_Test_Neg_createItemBefore3());
execute(tc_EPTF_NQueue_Test_Neg_createItemBefore4());
execute(tc_EPTF_NQueue_Test_moveToHead());
execute(tc_EPTF_NQueue_Test_moveToTail());
execute(tc_EPTF_NQueue_Test_moveAfter());
execute(tc_EPTF_NQueue_Test_moveBefore());
execute(tc_EPTF_NQueue_Test_Neg_moveToHead1());
execute(tc_EPTF_NQueue_Test_Neg_moveToHead2());
execute(tc_EPTF_NQueue_Test_Neg_moveToHead3());
execute(tc_EPTF_NQueue_Test_Neg_moveToHead4());
execute(tc_EPTF_NQueue_Test_Neg_moveToHead5());
execute(tc_EPTF_NQueue_Test_Neg_moveToTail1());
execute(tc_EPTF_NQueue_Test_Neg_moveToTail2());
execute(tc_EPTF_NQueue_Test_Neg_moveToTail3());
execute(tc_EPTF_NQueue_Test_Neg_moveToTail4());
execute(tc_EPTF_NQueue_Test_Neg_moveToTail5());
execute(tc_EPTF_NQueue_Test_Neg_moveAfter1());
execute(tc_EPTF_NQueue_Test_Neg_moveAfter2());
execute(tc_EPTF_NQueue_Test_Neg_moveAfter3());
execute(tc_EPTF_NQueue_Test_Neg_moveAfter4());
execute(tc_EPTF_NQueue_Test_Neg_moveAfter5());
execute(tc_EPTF_NQueue_Test_Neg_moveBefore1());
execute(tc_EPTF_NQueue_Test_Neg_moveBefore2());
execute(tc_EPTF_NQueue_Test_Neg_moveBefore3());
execute(tc_EPTF_NQueue_Test_Neg_moveBefore4());
execute(tc_EPTF_NQueue_Test_Neg_moveBefore5());
execute(tc_EPTF_NQueue_Test_getFunctionsBasic());
execute(tc_EPTF_NQueue_Test_getHeadAndTailWithOneLengthChain());
execute(tc_EPTF_NQueue_Test_getFunctionsWithEmptiedChain());
execute(tc_EPTF_NQueue_Test_createItemFunctionsWith3Chains());
execute(tc_EPTF_NQueue_Test_Neg_getLengthFunctions1());
execute(tc_EPTF_NQueue_Test_Neg_getLengthFunctions2());
execute(tc_EPTF_NQueue_Test_Neg_createQueueWithName());
}
} // module