sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\buffer\t_que.cpp sl@0: // Overview: sl@0: // Test double linked list functionality. sl@0: // API Information: sl@0: // TDblQueLinkBase, TDeltaQueLink, TDblQueLink, TPriQueLink, sl@0: // TDblQueIterBase, TDblQueIter sl@0: // Details: sl@0: // - Create many TDblQueLinkBase links, insert links at specified locations sl@0: // and check previous and next links are as expected. sl@0: // - Create many TDeltaQueLink links, insert these links at specified locations sl@0: // and check previous and next links are as expected. sl@0: // - Create many TDblQueLink links, insert, remove these links at specified sl@0: // locations and check previous and next links are as expected. sl@0: // - Create many TPriQueLink links, insert, remove these links at specified sl@0: // locations and check previous and next links are as expected. sl@0: // - Create TDblQueBase based object without offset, with specified offset sl@0: // and check it is constructed as expected. sl@0: // - Create TDblQueBase based object, insert and remove TPriQueLink list sl@0: // element, set priorities of TPriQueLink list elements, call IsEmpty sl@0: // and Reset methods. sl@0: // - Create TDblQueBase based object without, with offset and check sl@0: // it is constructed as expected sl@0: // - Create TDblQueBase based object, insert TDblQueLink links at sl@0: // specified locations and check that they are added as expected. sl@0: // - Initialise TPriQueLink link with different priorities, insert sl@0: // the elements in priority order and check that they are added sl@0: // as expected. sl@0: // - Create TDblQueBase based object, check the double linked list for empty sl@0: // before inserting, after inserting, before/after Deque, before/after Enque, sl@0: // after Reset. Verify that results are as expected. sl@0: // - Create TDeltaQueBase object without offset, with specified offset sl@0: // and check it is constructed as expected. Insert TDeltaQueLink list sl@0: // elements at specified distance from the zero point, remove the elements sl@0: // at specified distance, decrement the delta value. sl@0: // - Create TDeltaQueBase based object, insert TDblQueLink link at specified sl@0: // locations and check the previous, next link are as expected. sl@0: // - Check the linked list for empty before inserting, after inserting, sl@0: // before/after Deque, before/after Enque, after Reset. Verify that results sl@0: // are as expected. sl@0: // - Create TDeltaQueBase based object, insert links using DoAddDelta method, sl@0: // check that links are as expected. Delete links using DoRemove and sl@0: // DoRemoveFirst methods and check that links are as expected. sl@0: // - Create TDeltaQueBase based object, insert links using DoAddDelta method, sl@0: // check the return value of CountDown is as expected. Delete links using sl@0: // DoRemoveFirst method and check the return value of CountDown is as expected. sl@0: // - Create TDblQue based object, insert links at front and last, call IsHead, sl@0: // IsFirst, IsLast, First and Last methods. sl@0: // - Create TDblQue object, check list for empty before inserting, after sl@0: // inserting, before/after Deque, before/after Enque, after Reset. sl@0: // Verify that results are as expected. sl@0: // - Create TDblQue based object with offset constructor, insert links at sl@0: // specified locations and check it is added as specified. sl@0: // - Create TDblQue based object, insert links using AddFirst and AddLast and sl@0: // check the links are as expected. sl@0: // - Create TDblQue based object, insert links using AddFirst and AddLast and sl@0: // check the result of the IsHead, IsFirst and IsLast methods are as expected. sl@0: // - Create TDblQue based object, insert links using AddFirst and AddLast, check sl@0: // the results are as expected. sl@0: // - Create TPriQueLink list without offset, with different offset, check the sl@0: // construction is as expected. sl@0: // - Create TPriQueLink list and insert many links at different specified location sl@0: // and check it is added as specified. sl@0: // - Create TPriQueLink link with different priorities, insert the elements in sl@0: // priority order and check that they are added as expected. sl@0: // - Create TPriQueLink list, check the double linked list for empty before sl@0: // inserting, after inserting, before/after Deque, before/after Enque, after Reset. sl@0: // Verify that results are as expected. sl@0: // - Create TPriQueLink list with different offset, get the list offset and check it sl@0: // is as expected. sl@0: // - Create TPriQueLink list, insert many links with different priorities check it is sl@0: // as expected. sl@0: // - Create TDeltaQueLink list, add ,remove links and check the links and check sl@0: // it is as expected. sl@0: // - Create TDeltaQueLink list and insert many links at different specified location sl@0: // and check it is added as specified. sl@0: // - Create TDeltaQueLink list, check the double linked list for empty before, after sl@0: // inserting, before Deque, after Enque, Reset method call is as expected. sl@0: // - Create TDeltaQueLink list, insert links using DoAddDelta method,check that sl@0: // links are as expected. Delete links using DoRemove and DoRemoveFirst methods sl@0: // and check that links are as expected. sl@0: // - Create TDeltaQueLink based object, insert links using DoAddDelta method, sl@0: // check the return value of CountDown is as expected. Delete links using sl@0: // DoRemoveFirst method and check the return value of CountDown is as expected. sl@0: // - Create TDeltaQueLink list with different offset, get and check the offset is sl@0: // as expected. sl@0: // - Create TDeltaQueLink list, add, remove links at different specified location sl@0: // and check it is added and removed successfully. sl@0: // - Initialaize TDblQueIterBase based iterator, get the current item in the queue, sl@0: // move the current position forward, backward, set the iterator to point to the sl@0: // first element, last item and check it is as expected. sl@0: // - Create TDblQueIterBase object with offset constructor, insert links at sl@0: // specified locations and check it is added as specified. sl@0: // - Create TDblQueIterBase object, iterate the list using operators, DoPostInc, sl@0: // DoPostDec, DoCurrent and check it is as expected. sl@0: // - Create TDblQue based link with specified offset, initialize TDblQueIter sl@0: // based iterator, iterate the link and check the offset is as expected. sl@0: // - Create TDblQueIter object with offset constructor, insert links at sl@0: // specified locations and check it is added as specified. sl@0: // - Create TDblQueIter object, iterate the list using operators, DoPostInc, sl@0: // DoPostDec, DoCurrent and check it is as expected. sl@0: // - Create TDblQueIter based object, insert links using AddFirst and SetToLast, sl@0: // using IsHead, check the results are as expected. sl@0: // Platforms/Drives/Compatibility: sl@0: // All sl@0: // Assumptions/Requirement/Pre-requisites: sl@0: // Failures and causes: sl@0: // Base Port information: sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: LOCAL_D RTest test(_L("T_QUE")); sl@0: sl@0: #ifndef _DEBUG sl@0: #pragma warning(disable : 4710) //fuction not expanded sl@0: #endif sl@0: sl@0: #define SIZE 10 sl@0: #define MAX_OFFSET 10 sl@0: sl@0: struct Item sl@0: { sl@0: TDblQueLink iLink; sl@0: TInt iSpace[MAX_OFFSET]; // Reserve some space sl@0: }; sl@0: sl@0: class CItem : public CBase sl@0: { sl@0: public: sl@0: TDblQueLink iLink; sl@0: //int iSpac[MAX_OFFSET]; // Reserve some space sl@0: }; sl@0: sl@0: template sl@0: class TestTQueLink sl@0: { sl@0: public: sl@0: void TestQueLinkBase(); // Calls Test: 1. sl@0: void TestQueLink(); // Calls Test: 1,2. sl@0: void Test1(); // Test Enque sl@0: void Test2(); // Test Deque sl@0: protected: sl@0: void CreateObjects(TInt aBaseLink); sl@0: void DestroyObjects(); sl@0: private: sl@0: void CallTest1(); sl@0: T* iLink[SIZE]; sl@0: }; sl@0: sl@0: template sl@0: void TestTQueLink::CallTest1() sl@0: { sl@0: test.Start(_L("Test Enque")); sl@0: Test1(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueLink::CreateObjects(TInt aBaseLink) sl@0: { sl@0: TInt i; sl@0: sl@0: for (i=0;i=0&&aBaseLinkiNext=(iLink[aBaseLink])->iPrev=iLink[aBaseLink]; sl@0: } sl@0: sl@0: template sl@0: void TestTQueLink::DestroyObjects() sl@0: { sl@0: TInt i; sl@0: sl@0: for (i=0;i sl@0: void TestTQueLink::TestQueLinkBase() sl@0: { sl@0: CallTest1(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueLink::TestQueLink() sl@0: { sl@0: CallTest1(); sl@0: test.Next(_L("Text Deque")); sl@0: Test2(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueLink::Test1() sl@0: { sl@0: CreateObjects(1); sl@0: test.Start(_L("Check Next and Prev pointers set corectly.")); sl@0: iLink[2]->Enque(iLink[1]); sl@0: test(iLink[1]->iPrev==iLink[2]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[1]); sl@0: iLink[3]->Enque(iLink[2]); sl@0: test(iLink[1]->iPrev==iLink[3]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[3]); sl@0: test(iLink[3]->iPrev==iLink[2]); sl@0: test(iLink[3]->iNext==iLink[1]); sl@0: iLink[4]->Enque(iLink[3]); sl@0: test(iLink[1]->iPrev==iLink[4]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[3]); sl@0: test(iLink[3]->iPrev==iLink[2]); sl@0: test(iLink[3]->iNext==iLink[4]); sl@0: test(iLink[4]->iPrev==iLink[3]); sl@0: test(iLink[4]->iNext==iLink[1]); sl@0: iLink[5]->Enque(iLink[2]); sl@0: test(iLink[1]->iPrev==iLink[4]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[5]); sl@0: test(iLink[5]->iPrev==iLink[2]); sl@0: test(iLink[5]->iNext==iLink[3]); sl@0: test(iLink[3]->iPrev==iLink[5]); sl@0: test(iLink[3]->iNext==iLink[4]); sl@0: test(iLink[4]->iPrev==iLink[3]); sl@0: test(iLink[4]->iNext==iLink[1]); sl@0: test.Next(_L("Finished")); sl@0: DestroyObjects(); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueLink::Test2() sl@0: { sl@0: CreateObjects(1); sl@0: test.Start(_L("Check Next and Prev pointers set corectly")); sl@0: iLink[2]->Enque(iLink[1]); sl@0: iLink[3]->Enque(iLink[2]); sl@0: iLink[4]->Enque(iLink[3]); sl@0: iLink[5]->Enque(iLink[4]); sl@0: iLink[5]->Deque(); sl@0: iLink[5]->Enque(iLink[2]); sl@0: test(iLink[1]->iPrev==iLink[4]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[5]); sl@0: test(iLink[5]->iPrev==iLink[2]); sl@0: test(iLink[5]->iNext==iLink[3]); sl@0: test(iLink[3]->iPrev==iLink[5]); sl@0: test(iLink[3]->iNext==iLink[4]); sl@0: test(iLink[4]->iPrev==iLink[3]); sl@0: test(iLink[4]->iNext==iLink[1]); sl@0: iLink[3]->Deque(); sl@0: test(iLink[1]->iPrev==iLink[4]); sl@0: test(iLink[1]->iNext==iLink[2]); sl@0: test(iLink[2]->iPrev==iLink[1]); sl@0: test(iLink[2]->iNext==iLink[5]); sl@0: test(iLink[5]->iPrev==iLink[2]); sl@0: test(iLink[5]->iNext==iLink[4]); sl@0: test(iLink[4]->iPrev==iLink[5]); sl@0: test(iLink[4]->iNext==iLink[1]); sl@0: iLink[1]->Deque(); sl@0: test(iLink[2]->iPrev==iLink[4]); sl@0: test(iLink[2]->iNext==iLink[5]); sl@0: test(iLink[5]->iPrev==iLink[2]); sl@0: test(iLink[5]->iNext==iLink[4]); sl@0: test(iLink[4]->iPrev==iLink[5]); sl@0: test(iLink[4]->iNext==iLink[2]); sl@0: iLink[4]->Deque(); sl@0: test(iLink[2]->iPrev==iLink[5]); sl@0: test(iLink[2]->iNext==iLink[5]); sl@0: test(iLink[5]->iPrev==iLink[2]); sl@0: test(iLink[5]->iNext==iLink[2]); sl@0: test.Next(_L("Finished")); sl@0: DestroyObjects(); sl@0: test.End(); sl@0: } sl@0: sl@0: class VDblQueBase : public TDblQueBase sl@0: { sl@0: public: sl@0: VDblQueBase(); sl@0: VDblQueBase(TInt anOffset); sl@0: inline void sDoAddFirst(TAny* aPtr) {DoAddFirst(aPtr);} sl@0: inline void sDoAddLast(TAny* aPtr) {DoAddLast(aPtr);} sl@0: inline void sDoAddPriority(TAny* aPtr) {DoAddPriority(aPtr);} sl@0: inline void sTestEmpty() const {__DbgTestEmpty();} sl@0: TDblQueLink* sHead; sl@0: TInt* sOffset; sl@0: private: sl@0: void SetMembers(); sl@0: }; sl@0: sl@0: class VDeltaQueBase : public TDeltaQueBase sl@0: { sl@0: public: sl@0: VDeltaQueBase(); sl@0: VDeltaQueBase(TInt anOffset); sl@0: inline void sDoAddDelta(TAny* aPtr,TInt aDelta) {DoAddDelta(aPtr,aDelta);} //From TDeltaQueBase sl@0: inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);} sl@0: inline TAny* sDoRemoveFirst() {return this->DoRemoveFirst();} sl@0: TInt** sFirstDelta; sl@0: inline void sDoAddFirst(TAny* aPtr) {DoAddFirst(aPtr);} //From TDblQueBase sl@0: inline void sDoAddLast(TAny* aPtr) {DoAddLast(aPtr);} sl@0: inline void sDoAddPriority(TAny* aPtr) {DoAddPriority(aPtr);} sl@0: TDblQueLink* sHead; sl@0: TInt* sOffset; sl@0: private: sl@0: void SetMembers(); sl@0: }; sl@0: sl@0: template sl@0: class VDblQue : public TDblQue sl@0: { sl@0: public: sl@0: VDblQue(); sl@0: VDblQue(TInt anOffset); sl@0: /*inline void sDoAddDelta(TAny* aPtr,TInt aDelta) {DoAddDelta(aPtr,aDelta);} //From TDeltaQueBase sl@0: inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);} sl@0: inline TAny* sDoRemoveFirst() {return this->DoRemoveFirst();} sl@0: TInt** sFirstDelta;*/ sl@0: inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);} //From TDblQueBase sl@0: inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);} sl@0: inline void sDoAddPriority(TAny* aPtr) {this->DoAddPriority(aPtr);} sl@0: TDblQueLink* sHead; sl@0: TInt* sOffset; sl@0: private: sl@0: void SetMembers(); sl@0: }; sl@0: sl@0: template sl@0: class VPriQue : public TPriQue sl@0: { sl@0: public: sl@0: VPriQue(); sl@0: VPriQue(TInt anOffset); sl@0: /*inline void sDoAddDelta(TAny* aPtr,TInt aDelta) {DoAddDelta(aPtr,aDelta);} //From TDeltaQueBase sl@0: inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);} sl@0: inline TAny* sDoRemoveFirst() {return this->DoRemoveFirst();} sl@0: TInt** sFirstDelta;*/ sl@0: inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);} //From TDblQueBase sl@0: inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);} sl@0: inline void sDoAddPriority(TAny* aPtr) {this->DoAddPriority(aPtr);} sl@0: TDblQueLink* sHead; sl@0: TInt* sOffset; sl@0: private: sl@0: void SetMembers(); sl@0: }; sl@0: sl@0: template sl@0: class VDeltaQue : public TDeltaQue sl@0: { sl@0: public: sl@0: VDeltaQue(); sl@0: VDeltaQue(TInt anOffset); sl@0: inline void sDoAddDelta(TAny* aPtr,TInt aDelta) {this->DoAddDelta(aPtr,aDelta);} //From TDeltaQueBase sl@0: inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);} sl@0: inline TAny* sDoRemoveFirst() {return this->DoRemoveFirst();} sl@0: TInt** sFirstDelta; sl@0: inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);} //From TDblQueBase sl@0: inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);} sl@0: inline void sDoAddPriority(TAny* aPtr) {this->DoAddPriority(aPtr);} sl@0: TDblQueLink* sHead; sl@0: TInt* sOffset; sl@0: private: sl@0: void SetMembers(); sl@0: }; sl@0: sl@0: VDblQueBase::VDblQueBase() sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: VDblQueBase::VDblQueBase(TInt anOffset) sl@0: :TDblQueBase(anOffset) sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: void VDblQueBase::SetMembers() sl@0: { sl@0: sHead=&iHead; sl@0: sOffset=&iOffset; sl@0: } sl@0: sl@0: VDeltaQueBase::VDeltaQueBase() sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: VDeltaQueBase::VDeltaQueBase(TInt anOffset) sl@0: :TDeltaQueBase(anOffset) sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: void VDeltaQueBase::SetMembers() sl@0: { sl@0: sFirstDelta=&iFirstDelta; sl@0: sHead=&iHead; sl@0: sOffset=&iOffset; sl@0: } sl@0: sl@0: template sl@0: VDblQue::VDblQue() sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: VDblQue::VDblQue(TInt anOffset) sl@0: :TDblQue(anOffset) sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: void VDblQue::SetMembers() sl@0: { sl@0: //sFirstDelta=&iFirstDelta; sl@0: sHead=&this->iHead; sl@0: sOffset=&this->iOffset; sl@0: } sl@0: sl@0: template sl@0: VPriQue::VPriQue() sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: VPriQue::VPriQue(TInt anOffset) sl@0: :TPriQue(anOffset) sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: void VPriQue::SetMembers() sl@0: { sl@0: //sFirstDelta=&iFirstDelta; sl@0: sHead=&this->iHead; sl@0: sOffset=&this->iOffset; sl@0: } sl@0: sl@0: template sl@0: VDeltaQue::VDeltaQue() sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: VDeltaQue::VDeltaQue(TInt anOffset) sl@0: :TDeltaQue(anOffset) sl@0: { sl@0: SetMembers(); sl@0: } sl@0: sl@0: template sl@0: void VDeltaQue::SetMembers() sl@0: { sl@0: sFirstDelta=&this->iFirstDelta; sl@0: sHead=&this->iHead; sl@0: sOffset=&this->iOffset; sl@0: } sl@0: sl@0: template sl@0: class TestTQue sl@0: { sl@0: friend class TestTQueLink; sl@0: public: sl@0: void TestQueBase(); sl@0: void TestDeltaBase(); sl@0: void TestDblQue(); sl@0: void TestPriQue(); sl@0: void TestDeltaQue(); sl@0: void Test1(); // All functions //TDblQueBase functions sl@0: void Test2(); // Constructors sl@0: void Test3(TBool aTestPri); // DoAdd's sl@0: void Test4(); // Public functions sl@0: void Test5(); // All functions //TDblDeltaQueBase sl@0: void Test6(); // Constructors sl@0: void Test7(); // Do's sl@0: void Test8(); // CountDown sl@0: void Test9(); // All functions //TDblQueBase sl@0: void Test10(); // Constructors sl@0: void Test11(); // Add's sl@0: void Test12(); // Is's sl@0: void Test13(); // Get's sl@0: void Test14(); // All functions //TPriQue sl@0: void Test15(); // Constructors sl@0: void Test16(); // Add sl@0: void Test17(); // All functions //TDeltaQue sl@0: void Test18(); // Constructors sl@0: void Test19(); // Add/Remove sl@0: private: sl@0: void CallTest3_4(TBool aTestPri); sl@0: void CallTest7_8(); sl@0: }; sl@0: sl@0: template sl@0: void TestTQue::CallTest3_4(TBool aTestPri) sl@0: { sl@0: test.Next(_L("Test DoAdd's")); sl@0: Test3(aTestPri); sl@0: test.Next(_L("Test public functions")); sl@0: Test4(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::CallTest7_8() sl@0: { sl@0: test.Next(_L("Test Do's")); sl@0: Test7(); sl@0: test.Next(_L("CountDown")); sl@0: Test8(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::TestQueBase() sl@0: { sl@0: test.Start(_L("Test all member functions (simply)")); sl@0: Test1(); sl@0: test.Next(_L("Test Constructors")); sl@0: Test2(); sl@0: CallTest3_4(ETrue); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::TestDeltaBase() sl@0: { sl@0: test.Start(_L("Test all member functions (simply)")); sl@0: Test5(); sl@0: CallTest3_4(EFalse); sl@0: test.Next(_L("Test Constructors")); sl@0: Test6(); sl@0: CallTest7_8(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::TestDblQue() sl@0: { sl@0: test.Start(_L("Test all member functions (simply)")); sl@0: Test9(); sl@0: CallTest3_4(EFalse); sl@0: test.Next(_L("Test Constructor")); sl@0: Test10(); sl@0: test.Next(_L("Test Add's")); sl@0: Test11(); sl@0: test.Next(_L("Test Is's")); sl@0: Test12(); sl@0: test.Next(_L("Get's")); sl@0: Test13(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::TestPriQue() sl@0: { sl@0: test.Start(_L("Test all member functions (simply)")); sl@0: Test14(); sl@0: CallTest3_4(ETrue); sl@0: test.Next(_L("Test Constructor")); sl@0: Test15(); sl@0: test.Next(_L("Test Add")); sl@0: Test16(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::TestDeltaQue() sl@0: { sl@0: test.Start(_L("Test all member functions (simply)")); sl@0: Test17(); sl@0: CallTest3_4(EFalse); sl@0: CallTest7_8(); sl@0: test.Next(_L("Test Constructor")); sl@0: Test18(); sl@0: test.Next(_L("Test Add/Removes")); sl@0: Test19(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test1() sl@0: { sl@0: T* que; sl@0: TPriQueLink link1,link2; sl@0: TInt offset=4; sl@0: sl@0: test.Start(_L("Constructors")); sl@0: que=new VDblQueBase(offset); sl@0: delete que; sl@0: que=new VDblQueBase; sl@0: //delete que; sl@0: test.Next(_L("DoAdd's")); sl@0: que->sDoAddFirst(&link1); sl@0: link1.Deque(); sl@0: que->sDoAddLast(&link1); sl@0: link1.iPriority=1; sl@0: link2.iPriority=2; sl@0: que->sDoAddPriority(&link2); sl@0: test.Next(_L("Public")); sl@0: que->IsEmpty(); sl@0: que->SetOffset(offset); sl@0: que->Reset(); sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test2() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("Default constructor")); sl@0: que=new VDblQueBase(); sl@0: test(*(que->sOffset)==0); sl@0: test(que->sHead->iNext==que->sHead); sl@0: test(que->sHead->iPrev==que->sHead); sl@0: delete que; sl@0: test.Next(_L("Offset constructor")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new VDblQueBase(offset); sl@0: test(*(que->sOffset)==offset); sl@0: test(que->sHead->iNext==que->sHead); sl@0: test(que->sHead->iPrev==que->sHead); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test3(TBool aTestPri) sl@0: { sl@0: T* que; sl@0: TDblQueLink link1,link2,link3,link4; sl@0: sl@0: test.Start(_L("AddFirst")); sl@0: que=new T(); sl@0: que->sDoAddFirst(&link1); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==que->sHead); sl@0: que->sDoAddFirst(&link2); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==que->sHead); sl@0: que->sDoAddFirst(&link3); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==&link3); sl@0: test(link3.iNext==&link2); sl@0: test(link3.iPrev==que->sHead); sl@0: que->sDoAddFirst(&link4); sl@0: test(que->sHead->iNext==&link4); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==&link3); sl@0: test(link3.iNext==&link2); sl@0: test(link3.iPrev==&link4); sl@0: test(link4.iNext==&link3); sl@0: test(link4.iPrev==que->sHead); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("AddLast")); sl@0: que=new T(); sl@0: que->sDoAddLast(&link1); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==que->sHead); sl@0: que->sDoAddLast(&link2); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: que->sDoAddLast(&link3); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link3); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==&link3); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==que->sHead); sl@0: test(link3.iPrev==&link2); sl@0: que->sDoAddLast(&link4); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link4); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==&link3); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link4); sl@0: test(link3.iPrev==&link2); sl@0: test(link4.iNext==que->sHead); sl@0: test(link4.iPrev==&link3); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("Combined AddFirst and AddLast")); sl@0: que=new T(); sl@0: que->sDoAddFirst(&link1); sl@0: que->sDoAddLast(&link2); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: que->sDoAddFirst(&link3); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==&link3); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link1); sl@0: test(link3.iPrev==que->sHead); sl@0: que->sDoAddLast(&link4); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link4); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==&link3); sl@0: test(link2.iNext==&link4); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link1); sl@0: test(link3.iPrev==que->sHead); sl@0: test(link4.iNext==que->sHead); sl@0: test(link4.iPrev==&link2); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: if (aTestPri) sl@0: { sl@0: TPriQueLink link5,link6,link7,link8,link9,link10; sl@0: sl@0: test.Next(_L("AddPriority")); sl@0: que=new T(); sl@0: link5.iPriority=4; sl@0: link6.iPriority=6; sl@0: link7.iPriority=8; sl@0: que->sDoAddPriority(&link5); sl@0: que->sDoAddPriority(&link6); sl@0: que->sDoAddPriority(&link7); sl@0: test(que->sHead->iNext==&link7); sl@0: test(que->sHead->iPrev==&link5); sl@0: test(link5.iNext==que->sHead); sl@0: test(link5.iPrev==&link6); sl@0: test(link6.iNext==&link5); sl@0: test(link6.iPrev==&link7); sl@0: test(link7.iNext==&link6); sl@0: test(link7.iPrev==que->sHead); sl@0: link8.iPriority=7; sl@0: que->sDoAddPriority(&link8); sl@0: test(que->sHead->iNext==&link7); sl@0: test(que->sHead->iPrev==&link5); sl@0: test(link5.iNext==que->sHead); sl@0: test(link5.iPrev==&link6); sl@0: test(link6.iNext==&link5); sl@0: test(link6.iPrev==&link8); sl@0: test(link7.iNext==&link8); sl@0: test(link7.iPrev==que->sHead); sl@0: test(link8.iPrev==&link7); sl@0: test(link8.iNext==&link6); sl@0: link9.iPriority=5; sl@0: que->sDoAddPriority(&link9); sl@0: test(que->sHead->iNext==&link7); sl@0: test(que->sHead->iPrev==&link5); sl@0: test(link5.iNext==que->sHead); sl@0: test(link5.iPrev==&link9); sl@0: test(link6.iNext==&link9); sl@0: test(link6.iPrev==&link8); sl@0: test(link7.iNext==&link8); sl@0: test(link7.iPrev==que->sHead); sl@0: test(link8.iPrev==&link7); sl@0: test(link8.iNext==&link6); sl@0: test(link9.iPrev==&link6); sl@0: test(link9.iNext==&link5); sl@0: link10.iPriority=3; sl@0: que->sDoAddPriority(&link10); sl@0: test(que->sHead->iNext==&link7); sl@0: test(que->sHead->iPrev==&link10); sl@0: test(link5.iNext==&link10); sl@0: test(link5.iPrev==&link9); sl@0: test(link6.iNext==&link9); sl@0: test(link6.iPrev==&link8); sl@0: test(link7.iNext==&link8); sl@0: test(link7.iPrev==que->sHead); sl@0: test(link8.iPrev==&link7); sl@0: test(link8.iNext==&link6); sl@0: test(link9.iPrev==&link6); sl@0: test(link9.iNext==&link5); sl@0: test(link10.iNext==que->sHead); sl@0: test(link10.iPrev==&link5); sl@0: link5.Deque(); sl@0: link6.Deque(); sl@0: link7.Deque(); sl@0: link8.Deque(); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test4() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("IsEmpty")); sl@0: que=new T(); sl@0: test(que->IsEmpty()==TRUE); sl@0: TDblQueLink link1,link2; sl@0: que->sDoAddFirst(&link1); sl@0: test(que->IsEmpty()==FALSE); sl@0: link1.Deque(); sl@0: test(que->IsEmpty()==TRUE); sl@0: que->sDoAddLast(&link2); sl@0: test(que->IsEmpty()==FALSE); sl@0: link1.Enque(&link2); sl@0: test(que->IsEmpty()==FALSE); sl@0: link2.Deque(); sl@0: test(que->IsEmpty()==FALSE); sl@0: link1.Deque(); sl@0: test(que->IsEmpty()==TRUE); sl@0: test.Next(_L("Reset")); sl@0: que->sDoAddFirst(&link1); sl@0: test(que->IsEmpty()==FALSE); sl@0: que->Reset(); sl@0: test(que->IsEmpty()==TRUE); sl@0: test.Next(_L("SetOffset")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que->SetOffset(offset); sl@0: test(*(que->sOffset)==offset); sl@0: } sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test5() sl@0: { sl@0: T* que; sl@0: TDeltaQueLink link1,link2,link3; sl@0: TInt offset=4; sl@0: sl@0: test.Start(_L("Constructors")); sl@0: que=new VDeltaQueBase(offset); sl@0: delete que; sl@0: que=new VDeltaQueBase; sl@0: test.Next(_L("Do's")); sl@0: que->sDoAddDelta(&link1,3); sl@0: que->sDoAddDelta(&link2,2); sl@0: que->sDoAddDelta(&link3,0); sl@0: que->sDoRemoveFirst(); sl@0: que->sDoRemove(&link2); sl@0: test.Next(_L("CountDown")); sl@0: que->CountDown(); sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test6() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("Default constructor")); sl@0: que=new VDeltaQueBase(); sl@0: test(*(que->sFirstDelta)==NULL); sl@0: delete que; sl@0: test.Next(_L("Offset constructor")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new VDeltaQueBase(offset); sl@0: test(*(que->sOffset)==offset); sl@0: test(*(que->sFirstDelta)==NULL); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test7() sl@0: { sl@0: T* que; sl@0: TDeltaQueLink link1,link2,link3,link4,link5,link6; sl@0: sl@0: test.Start(_L("DoAddDelta")); sl@0: que=new T(); sl@0: que->sDoAddDelta(&link2,3); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: que->sDoAddDelta(&link5,15); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link5.iDelta==12); sl@0: que->sDoAddDelta(&link3,6); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link5.iDelta==9); sl@0: que->sDoAddDelta(&link4,10); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->sDoAddDelta(&link1,1); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->sDoAddDelta(&link6,21); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: test(link6.iDelta==6); sl@0: test.Next(_L("DoRemove")); sl@0: que->sDoRemove(&link6); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->sDoRemove(&link1); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->sDoRemove(&link4); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link5.iDelta==9); sl@0: que->sDoRemove(&link3); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link5.iDelta==12); sl@0: que->sDoRemove(&link5); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test.Next(_L("DoRemoveFirst")); sl@0: test(NULL==que->sDoRemoveFirst()); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: link2.iDelta=1; sl@0: test(NULL==que->sDoRemoveFirst()); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==1); sl@0: link2.iDelta=0; sl@0: test(&link2==que->sDoRemoveFirst()); sl@0: delete que; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test8() sl@0: { sl@0: T* que; sl@0: TDeltaQueLink link1,link2,link3; sl@0: sl@0: que=new T(); sl@0: que->sDoAddDelta(&link1,1); sl@0: que->sDoAddDelta(&link2,3); sl@0: que->sDoAddDelta(&link3,6); sl@0: test(que->CountDown()==TRUE); sl@0: que->sDoRemoveFirst(); sl@0: test(que->CountDown()==FALSE); sl@0: test(que->CountDown()==TRUE); sl@0: que->sDoRemoveFirst(); sl@0: test(que->CountDown()==FALSE); sl@0: test(que->CountDown()==FALSE); sl@0: test(que->CountDown()==TRUE); sl@0: que->sDoRemoveFirst(); sl@0: delete que; sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test9() sl@0: { sl@0: T* que; sl@0: TDblQueLink link1,link2; sl@0: TInt offset=4; sl@0: sl@0: test.Start(_L("Constructors")); sl@0: que=new VDblQue(offset); sl@0: delete que; sl@0: que=new VDblQue; sl@0: test.Next(_L("Add's")); sl@0: que->AddFirst(link1); sl@0: que->AddLast(link2); sl@0: test.Next(_L("Is's")); sl@0: que->IsHead(que->sHead); sl@0: que->IsFirst(&link1); sl@0: que->IsLast(&link2); sl@0: test.Next(_L("Get's")); sl@0: que->First(); sl@0: que->Last(); sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test10() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("Offset constructor")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new VDblQue(offset); sl@0: test(*(que->sOffset)==offset); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test11() sl@0: { sl@0: T* que; sl@0: TDblQueLink link1,link2,link3,link4; sl@0: sl@0: test.Start(_L("AddFirst")); sl@0: que=new T(); sl@0: que->AddFirst(link1); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==que->sHead); sl@0: que->AddFirst(link2); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==que->sHead); sl@0: que->AddFirst(link3); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==&link3); sl@0: test(link3.iNext==&link2); sl@0: test(link3.iPrev==que->sHead); sl@0: que->AddFirst(link4); sl@0: test(que->sHead->iNext==&link4); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==&link3); sl@0: test(link3.iNext==&link2); sl@0: test(link3.iPrev==&link4); sl@0: test(link4.iNext==&link3); sl@0: test(link4.iPrev==que->sHead); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("AddLast")); sl@0: que=new T(); sl@0: que->AddLast(link1); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link1); sl@0: test(link1.iNext==que->sHead); sl@0: test(link1.iPrev==que->sHead); sl@0: que->AddLast(link2); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: que->AddLast(link3); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link3); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==&link3); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==que->sHead); sl@0: test(link3.iPrev==&link2); sl@0: que->AddLast(link4); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link4); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==&link3); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link4); sl@0: test(link3.iPrev==&link2); sl@0: test(link4.iNext==que->sHead); sl@0: test(link4.iPrev==&link3); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("Combined AddFirst and AddLast")); sl@0: que=new T(); sl@0: que->AddFirst(link1); sl@0: que->AddLast(link2); sl@0: test(que->sHead->iNext==&link1); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==que->sHead); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: que->AddFirst(link3); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link2); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==&link3); sl@0: test(link2.iNext==que->sHead); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link1); sl@0: test(link3.iPrev==que->sHead); sl@0: que->AddLast(link4); sl@0: test(que->sHead->iNext==&link3); sl@0: test(que->sHead->iPrev==&link4); sl@0: test(link1.iNext==&link2); sl@0: test(link1.iPrev==&link3); sl@0: test(link2.iNext==&link4); sl@0: test(link2.iPrev==&link1); sl@0: test(link3.iNext==&link1); sl@0: test(link3.iPrev==que->sHead); sl@0: test(link4.iNext==que->sHead); sl@0: test(link4.iPrev==&link2); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test12() sl@0: { sl@0: T* que; sl@0: TDblQueLink link1,link2,link3,link4,*head; sl@0: sl@0: que=new T(); sl@0: que->AddFirst(link1); sl@0: que->AddLast(link2); sl@0: que->AddLast(link3); sl@0: que->AddLast(link4); sl@0: head=que->sHead; sl@0: test.Start(_L("IsHead")); sl@0: test(que->IsHead(head)==TRUE); sl@0: test(que->IsHead(&link1)==FALSE); sl@0: test(que->IsHead(&link2)==FALSE); sl@0: test(que->IsHead(&link3)==FALSE); sl@0: test(que->IsHead(&link4)==FALSE); sl@0: test.Next(_L("IsFirst")); sl@0: test(que->IsFirst(head)==FALSE); sl@0: test(que->IsFirst(&link1)==TRUE); sl@0: test(que->IsFirst(&link2)==FALSE); sl@0: test(que->IsFirst(&link3)==FALSE); sl@0: test(que->IsFirst(&link4)==FALSE); sl@0: test.Next(_L("IsLast")); sl@0: test(que->IsLast(head)==FALSE); sl@0: test(que->IsLast(&link1)==FALSE); sl@0: test(que->IsLast(&link2)==FALSE); sl@0: test(que->IsLast(&link3)==FALSE); sl@0: test(que->IsLast(&link4)==TRUE); sl@0: delete que; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test13() sl@0: { sl@0: T* que; sl@0: TDblQueLink link1,link2,link3,link4; sl@0: sl@0: test.Start(_L("First")); sl@0: que=new T(); sl@0: que->AddFirst(link1); sl@0: test(que->First()==&link1); sl@0: que->AddFirst(link2); sl@0: test(que->First()==&link2); sl@0: que->AddFirst(link3); sl@0: test(que->First()==&link3); sl@0: que->AddFirst(link4); sl@0: test(que->First()==&link4); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("Last")); sl@0: que=new T(); sl@0: que->AddLast(link1); sl@0: test(que->Last()==&link1); sl@0: que->AddLast(link2); sl@0: test(que->Last()==&link2); sl@0: que->AddLast(link3); sl@0: test(que->Last()==&link3); sl@0: que->AddLast(link4); sl@0: test(que->Last()==&link4); sl@0: link1.Deque(); sl@0: link2.Deque(); sl@0: link3.Deque(); sl@0: link4.Deque(); sl@0: delete que; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test14() sl@0: { sl@0: T* que; sl@0: TPriQueLink link; sl@0: TInt offset=4; sl@0: sl@0: test.Start(_L("Constructors")); sl@0: que=new VPriQue(offset); sl@0: delete que; sl@0: que=new VPriQue; sl@0: test.Next(_L("Add")); sl@0: que->Add(link); sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test15() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("Offset constructor")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new VPriQue(offset); sl@0: test(*(que->sOffset)==offset); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test16() sl@0: { sl@0: T* que; sl@0: TPriQueLink link1,link2,link3,link4,link5,link6; sl@0: sl@0: que=new T(); sl@0: link1.iPriority=4; sl@0: link2.iPriority=6; sl@0: link3.iPriority=2; sl@0: que->sDoAddPriority(&link1); sl@0: que->sDoAddPriority(&link2); sl@0: que->sDoAddPriority(&link3); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link3); sl@0: test(link1.iNext==&link3); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==que->sHead); sl@0: test(link3.iNext==que->sHead); sl@0: test(link3.iPrev==&link1); sl@0: link4.iPriority=3; sl@0: que->sDoAddPriority(&link4); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link3); sl@0: test(link1.iNext==&link4); sl@0: test(link1.iPrev==&link2); sl@0: test(link2.iNext==&link1); sl@0: test(link2.iPrev==que->sHead); sl@0: test(link3.iNext==que->sHead); sl@0: test(link3.iPrev==&link4); sl@0: test(link4.iNext==&link3); sl@0: test(link4.iPrev==&link1); sl@0: link5.iPriority=5; sl@0: que->sDoAddPriority(&link5); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link3); sl@0: test(link1.iNext==&link4); sl@0: test(link1.iPrev==&link5); sl@0: test(link2.iNext==&link5); sl@0: test(link2.iPrev==que->sHead); sl@0: test(link3.iNext==que->sHead); sl@0: test(link3.iPrev==&link4); sl@0: test(link4.iNext==&link3); sl@0: test(link4.iPrev==&link1); sl@0: test(link5.iNext==&link1); sl@0: test(link5.iPrev==&link2); sl@0: link6.iPriority=1; sl@0: que->sDoAddPriority(&link6); sl@0: test(que->sHead->iNext==&link2); sl@0: test(que->sHead->iPrev==&link6); sl@0: test(link1.iNext==&link4); sl@0: test(link1.iPrev==&link5); sl@0: test(link2.iNext==&link5); sl@0: test(link2.iPrev==que->sHead); sl@0: test(link3.iNext==&link6); sl@0: test(link3.iPrev==&link4); sl@0: test(link4.iNext==&link3); sl@0: test(link4.iPrev==&link1); sl@0: test(link5.iNext==&link1); sl@0: test(link5.iPrev==&link2); sl@0: test(link6.iNext==que->sHead); sl@0: test(link6.iPrev==&link3); sl@0: delete que; sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test17() sl@0: { sl@0: T* que; sl@0: TDeltaQueLink link1,link2; sl@0: TInt offset=4; sl@0: sl@0: test.Start(_L("Constructors")); sl@0: que=new VDeltaQue(offset); sl@0: delete que; sl@0: que=new VDeltaQue; sl@0: test.Next(_L("Add/Remove")); sl@0: que->Add(link1,0); sl@0: que->Add(link2,2); sl@0: que->Remove(link2); sl@0: que->RemoveFirst(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test18() sl@0: { sl@0: T* que; sl@0: TInt offset; sl@0: sl@0: test.Start(_L("Offset constructor")); sl@0: for (offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new VDeltaQue(offset); sl@0: test(*(que->sOffset)==offset); sl@0: delete que; sl@0: } sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQue::Test19() sl@0: { sl@0: T* que; sl@0: TDeltaQueLink link1,link2,link3,link4,link5,link6; sl@0: sl@0: test.Start(_L("Add")); sl@0: que=new T(); sl@0: que->Add(link2,3); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: que->Add(link5,15); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link5.iDelta==12); sl@0: que->Add(link3,6); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link5.iDelta==9); sl@0: que->Add(link4,10); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->Add(link1,1); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->Add(link6,21); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: test(link6.iDelta==6); sl@0: test.Next(_L("Remove")); sl@0: que->Remove(link6); sl@0: test(*(que->sFirstDelta)==&link1.iDelta); sl@0: test(link1.iDelta==1); sl@0: test(link2.iDelta==2); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->Remove(link1); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link4.iDelta==4); sl@0: test(link5.iDelta==5); sl@0: que->Remove(link4); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link3.iDelta==3); sl@0: test(link5.iDelta==9); sl@0: que->Remove(link3); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test(link5.iDelta==12); sl@0: que->Remove(link5); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: test.Next(_L("RemoveFirst")); sl@0: test(NULL==que->RemoveFirst()); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==3); sl@0: link2.iDelta=1; sl@0: test(NULL==que->RemoveFirst()); sl@0: test(*(que->sFirstDelta)==&link2.iDelta); sl@0: test(link2.iDelta==1); sl@0: link2.iDelta=0; sl@0: test(&link2==que->RemoveFirst()); sl@0: test.Next(_L("Finished")); sl@0: delete que; sl@0: test.End(); sl@0: } sl@0: sl@0: class VDblQueIterBase : public TDblQueIterBase sl@0: { sl@0: public: sl@0: VDblQueIterBase(TDblQueBase& aQue); sl@0: inline TAny* sDoPostInc() {return DoPostInc();} sl@0: inline TAny* sDoPostDec() {return DoPostDec();} sl@0: inline TAny* sDoCurrent() {return DoCurrent();} sl@0: TInt* sOffset; sl@0: TDblQueLinkBase** sHead; sl@0: TDblQueLinkBase** sNext; sl@0: private: sl@0: void SetMember(); sl@0: }; sl@0: sl@0: template sl@0: class VDblQueIter : public TDblQueIter sl@0: { sl@0: public: sl@0: VDblQueIter(TDblQueBase& aQue); sl@0: inline TAny* sDoPostInc() {return this->DoPostInc();} sl@0: inline TAny* sDoPostDec() {return this->DoPostDec();} sl@0: inline TAny* sDoCurrent() {return this->DoCurrent();} sl@0: TInt* sOffset; sl@0: TDblQueLinkBase** sHead; sl@0: TDblQueLinkBase** sNext; sl@0: private: sl@0: void SetMember(); sl@0: }; sl@0: sl@0: VDblQueIterBase::VDblQueIterBase(TDblQueBase& aQue) sl@0: :TDblQueIterBase(aQue) sl@0: { sl@0: SetMember(); sl@0: } sl@0: sl@0: void VDblQueIterBase::SetMember() sl@0: { sl@0: sOffset=&iOffset; sl@0: sHead=&iHead; sl@0: sNext=&iNext; sl@0: } sl@0: sl@0: template sl@0: VDblQueIter::VDblQueIter(TDblQueBase& aQue) sl@0: :TDblQueIter(aQue) sl@0: { sl@0: SetMember(); sl@0: } sl@0: sl@0: template sl@0: void VDblQueIter::SetMember() sl@0: { sl@0: sOffset=&this->iOffset; sl@0: sHead=&this->iHead; sl@0: sNext=&this->iNext; sl@0: } sl@0: sl@0: template sl@0: class TestTQueIter sl@0: { sl@0: public: sl@0: void TestIterBase(); sl@0: void TestQueIter(); sl@0: void Test1(); //All functions //TDblQueIterBase sl@0: void Test2(); //Constructors sl@0: void Test3(); //Do's sl@0: void Test4(); //Set sl@0: void Test5(); //All functions //TDblQueIter sl@0: void Test1Item(); sl@0: //void Test6(); //Constructors //Redundant sl@0: void Test7(); //Iterators sl@0: private: sl@0: void CallTest2_4(); sl@0: }; sl@0: sl@0: template sl@0: void TestTQueIter::CallTest2_4() sl@0: { sl@0: test.Next(_L("Constructors")); sl@0: Test2(); sl@0: test.Next(_L("Do's")); sl@0: Test3(); sl@0: test.Next(_L("Sets")); sl@0: Test4(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::TestIterBase() sl@0: { sl@0: test.Start(_L("All Methods")); sl@0: Test1(); sl@0: CallTest2_4(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::TestQueIter() sl@0: { sl@0: test.Start(_L("All Methods")); sl@0: Test5(); sl@0: CallTest2_4(); sl@0: test.Next(_L("One item in queue")); sl@0: Test1Item(); sl@0: test.Next(_L("Iterators")); sl@0: Test7(); sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test1() sl@0: { sl@0: Item item1,item2; sl@0: TDblQue que; sl@0: T* iter; sl@0: sl@0: que.AddFirst(item2); sl@0: que.AddFirst(item1); sl@0: test.Start(_L("Constructor")); sl@0: iter=new VDblQueIterBase(que); sl@0: test.Next(_L("Do's")); sl@0: iter->sDoCurrent(); sl@0: iter->sDoPostInc(); sl@0: iter->sDoPostDec(); sl@0: test.Next(_L("Sets")); sl@0: iter->SetToFirst(); sl@0: iter->SetToLast(); sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test2() sl@0: { sl@0: Item item; sl@0: TDblQue* que; sl@0: TInt offset; sl@0: T* iter; sl@0: sl@0: for(offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new TDblQue(offset); sl@0: new(PtrAdd(&item.iLink,offset)) TDblQueLink(); // create the link at this offset sl@0: iter=new T(*que); sl@0: test(que->IsHead((Item*) PtrSub(*(iter->sHead),offset))); //Need to pass a pointer to a item sl@0: test(que->IsHead((Item*) PtrSub(*(iter->sNext),offset))); sl@0: test(*(iter->sOffset)==offset); sl@0: delete iter; sl@0: delete que; sl@0: que=new TDblQue(offset); sl@0: new(PtrAdd(&item.iLink,offset)) TDblQueLink(); // create the link at this offset sl@0: que->AddFirst(item); sl@0: iter=new T(*que); sl@0: test(que->IsHead((Item*) PtrSub(*(iter->sHead),offset))); sl@0: test(*(iter->sNext)==PtrAdd(&item.iLink,offset)); //Need a pointer to a link sl@0: test(*(iter->sOffset)==offset); sl@0: PtrAdd(&item.iLink,offset)->Deque(); sl@0: delete iter; sl@0: delete que; sl@0: } sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test3() sl@0: { sl@0: Item item1,item2,item3,item4; sl@0: TDblQue que; sl@0: T* iter; sl@0: sl@0: que.AddFirst(item4); sl@0: que.AddFirst(item3); sl@0: que.AddFirst(item2); sl@0: que.AddFirst(item1); sl@0: test.Start(_L("DoPostInc")); sl@0: iter=new T(que); sl@0: test(&item1==iter->sDoPostInc()); sl@0: test(&item2.iLink==*(iter->sNext)); sl@0: test(&item2==iter->sDoPostInc()); sl@0: test(&item3.iLink==*(iter->sNext)); sl@0: test(&item3==iter->sDoPostInc()); sl@0: test(&item4.iLink==*(iter->sNext)); sl@0: test(&item4==iter->sDoPostInc()); sl@0: test(que.IsHead((Item*) *(iter->sNext))); sl@0: test(iter->sDoPostInc()==NULL); sl@0: delete iter; sl@0: test.Next(_L("DoPostDec")); sl@0: iter=new T(que); sl@0: iter->sDoPostInc(); sl@0: iter->sDoPostInc(); sl@0: iter->sDoPostInc(); sl@0: test(&item4.iLink==*(iter->sNext)); sl@0: test(&item4==iter->sDoPostDec()); sl@0: test(&item3.iLink==*(iter->sNext)); sl@0: test(&item3==iter->sDoPostDec()); sl@0: test(&item2.iLink==*(iter->sNext)); sl@0: test(&item2==iter->sDoPostDec()); sl@0: test(&item1.iLink==*(iter->sNext)); sl@0: test(&item1==iter->sDoPostDec()); sl@0: test(que.IsHead((Item*) *(iter->sNext))); sl@0: test(iter->sDoPostDec()==NULL); sl@0: delete iter; sl@0: test.Next(_L("DoCurrent")); sl@0: iter=new T(que); sl@0: test(&item1==iter->sDoCurrent()); sl@0: iter->sDoPostInc(); sl@0: test(&item2==iter->sDoCurrent()); sl@0: iter->sDoPostInc(); sl@0: test(&item3==iter->sDoCurrent()); sl@0: iter->sDoPostInc(); sl@0: test(&item4==iter->sDoCurrent()); sl@0: iter->sDoPostInc(); sl@0: test(iter->sDoCurrent()==NULL); sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test4() sl@0: { sl@0: Item item1,item2,item3,item4; sl@0: TDblQue que; sl@0: T* iter; sl@0: TInt i,j; sl@0: sl@0: que.AddFirst(item4); sl@0: que.AddFirst(item3); sl@0: que.AddFirst(item2); sl@0: que.AddFirst(item1); sl@0: test.Start(_L("SetToFirst")); sl@0: iter=new T(que); sl@0: for(i=0;i<5;i++) sl@0: { sl@0: for(j=0;jsDoPostInc(); sl@0: iter->SetToFirst(); sl@0: test(*(iter->sNext)==&item1.iLink); sl@0: } sl@0: delete iter; sl@0: test.Next(_L("SetToLast")); sl@0: iter=new T(que); sl@0: for(i=0;i<5;i++) sl@0: { sl@0: iter->SetToFirst(); sl@0: for(j=0;jsDoPostInc(); sl@0: iter->SetToLast(); sl@0: test(*(iter->sNext)==&item4.iLink); sl@0: } sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test5() sl@0: { sl@0: Item item1,item2; sl@0: TDblQue que; sl@0: T* iter; sl@0: Item* a; sl@0: sl@0: que.AddFirst(item2); sl@0: que.AddFirst(item1); sl@0: test.Start(_L("Constructor")); sl@0: iter=new T(que); sl@0: test.Next(_L("Iterators")); sl@0: a=*iter; sl@0: test(((*iter)++)==&item1); sl@0: test(((*iter)--)==&item2); sl@0: test(((*iter)++)==&item1); sl@0: test(((*iter)++)==&item2); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: iter->Set(item2); sl@0: test(((*iter)--)==&item2); sl@0: test(((*iter)++)==&item1); sl@0: test(((*iter)--)==&item2); sl@0: test(((*iter)--)==&item1); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: template sl@0: void TestTQueIter::Test1Item() sl@0: { sl@0: Item item; sl@0: TDblQue que; sl@0: T* iter; sl@0: sl@0: test.Start(_L("Constructor")); sl@0: iter=new T(que); sl@0: que.AddFirst(item); sl@0: iter->Set(item); sl@0: test.Next(_L("Iterators")); sl@0: test(((*iter)++)==&item); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: iter->Set(item); sl@0: test(((*iter)--)==&item); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)--)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: test(((*iter)++)==NULL); sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: /*template //Redundant sl@0: void TestTQueIter::Test6() sl@0: { sl@0: Item item; sl@0: TDblQue* que; sl@0: TInt offset; sl@0: T* iter; sl@0: sl@0: for(offset=0;offset<40;offset+=4) sl@0: { sl@0: que=new TDblQue(offset); sl@0: iter=new T(*que); sl@0: test(que->IsHead((Item*) *(iter->sHead))); sl@0: test(que->IsHead((Item*) *(iter->sNext))); sl@0: test(*(iter->sOffset)==offset); sl@0: delete iter; sl@0: delete que; sl@0: que=new TDblQue(offset); sl@0: que->AddFirst(item); sl@0: iter=new T(*que); sl@0: test(que->IsHead((Item*) *(iter->sHead))); sl@0: test(*(iter->sNext)==&item.iLink); sl@0: test(*(iter->sOffset)==offset); sl@0: delete iter; sl@0: delete que; sl@0: } sl@0: }*/ sl@0: sl@0: template sl@0: void TestTQueIter::Test7() sl@0: { sl@0: Item item1,item2,item3,item4; sl@0: TDblQue que; sl@0: T* iter; sl@0: sl@0: que.AddFirst(item4); sl@0: que.AddFirst(item3); sl@0: que.AddFirst(item2); sl@0: que.AddFirst(item1); sl@0: test.Start(_L("PostFix ++")); sl@0: iter=new T(que); sl@0: test(&item1==(*iter)++); sl@0: test(&item2.iLink==*(iter->sNext)); sl@0: test(&item2==(*iter)++); sl@0: test(&item3.iLink==*(iter->sNext)); sl@0: test(&item3==(*iter)++); sl@0: test(&item4.iLink==*(iter->sNext)); sl@0: test(&item4==(*iter)++); sl@0: test(que.IsHead((Item*) *(iter->sNext))); sl@0: test((*iter)++==NULL); sl@0: delete iter; sl@0: test.Next(_L("PostFix --")); sl@0: iter=new T(que); sl@0: iter->SetToLast(); sl@0: test(&item4.iLink==*(iter->sNext)); sl@0: test(&item4==(*iter)--); sl@0: test(&item3.iLink==*(iter->sNext)); sl@0: test(&item3==(*iter)--); sl@0: test(&item2.iLink==*(iter->sNext)); sl@0: test(&item2==(*iter)--); sl@0: test(&item1.iLink==*(iter->sNext)); sl@0: test(&item1==(*iter)--); sl@0: test(que.IsHead((Item*) *(iter->sNext))); sl@0: test((*iter)--==NULL); sl@0: delete iter; sl@0: test.Next(_L("Conversion Operator")); sl@0: iter=new T(que); sl@0: test(&item1==*iter); sl@0: (*iter)++; sl@0: test(&item2==*iter); sl@0: (*iter)++; sl@0: test(&item3==*iter); sl@0: (*iter)++; sl@0: test(&item4==*iter); sl@0: (*iter)++; sl@0: test(*iter==NULL); sl@0: delete iter; sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: sl@0: TestTQueLink* testDblQueLinkBase; sl@0: TestTQueLink* testDeltaQueLink; sl@0: TestTQueLink* testDblQueLink; sl@0: TestTQueLink* testPriQueLink; sl@0: TestTQue* testDblQueBase; sl@0: TestTQue* testDeltaQueBase; sl@0: TestTQue >* testDblQue; sl@0: TestTQue >* testPriQue; sl@0: TestTQue >* testDeltaQue; sl@0: TestTQueIter* testDblQueIterBase; sl@0: TestTQueIter >* testDblQueIter; sl@0: sl@0: // Test the queue classes. sl@0: test.Title(); sl@0: test.Start(_L("class TDblQueLinkBase")); sl@0: testDblQueLinkBase=new TestTQueLink; sl@0: testDblQueLinkBase->TestQueLinkBase(); sl@0: delete testDblQueLinkBase; sl@0: sl@0: test.Next(_L("class TDeltaQueLink")); sl@0: testDeltaQueLink=new TestTQueLink; sl@0: testDeltaQueLink->TestQueLinkBase(); sl@0: delete testDeltaQueLink; sl@0: sl@0: test.Next(_L("class TDblQueLink")); sl@0: testDblQueLink=new TestTQueLink; sl@0: testDblQueLink->TestQueLink(); sl@0: delete testDblQueLink; sl@0: sl@0: test.Next(_L("class TPriQueLink")); sl@0: testPriQueLink=new TestTQueLink; sl@0: testPriQueLink->TestQueLink(); sl@0: delete testPriQueLink; sl@0: sl@0: test.Next(_L("class TDblQueBase")); sl@0: testDblQueBase=new TestTQue; sl@0: testDblQueBase->TestQueBase(); sl@0: delete testDblQueBase; sl@0: sl@0: test.Next(_L("class TDeltaQueBase")); sl@0: testDeltaQueBase=new TestTQue; sl@0: testDeltaQueBase->TestDeltaBase(); sl@0: delete testDeltaQueBase; sl@0: sl@0: test.Next(_L("class TDlbQue")); sl@0: testDblQue=new TestTQue >; sl@0: testDblQue->TestDblQue(); sl@0: delete testDblQue; sl@0: sl@0: test.Next(_L("class TPriQue")); sl@0: testPriQue=new TestTQue >; sl@0: testPriQue->TestPriQue(); sl@0: delete testPriQue; sl@0: sl@0: test.Next(_L("class TDeltaQue")); sl@0: testDeltaQue=new TestTQue >; sl@0: testDeltaQue->TestDeltaQue(); sl@0: delete testDeltaQue; sl@0: sl@0: test.Next(_L("class TDblQueIterBase")); sl@0: testDblQueIterBase=new TestTQueIter; sl@0: testDblQueIterBase->TestIterBase(); sl@0: delete testDblQueIterBase; sl@0: sl@0: test.Next(_L("class TDblQueIter")); sl@0: testDblQueIter=new TestTQueIter >; sl@0: testDblQueIter->TestQueIter(); sl@0: delete testDblQueIter; sl@0: sl@0: test.Next(_L("Finished")); sl@0: test.End(); sl@0: return(0); sl@0: } sl@0: sl@0: #pragma warning(default : 4710) //fuction not expanded sl@0: