os/kernelhwsrv/kerneltest/e32test/buffer/t_sque.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\buffer\t_sque.cpp
sl@0
    15
// Overview:
sl@0
    16
// Test single linked list functionality.
sl@0
    17
// API Information:
sl@0
    18
// TSglQueLink, TSglQueBase.
sl@0
    19
// Details:
sl@0
    20
// - Create specified number of TSglQueLink objects, then delete them. 
sl@0
    21
// - Create TSglQueBase object with specified offset and without an offset,
sl@0
    22
// add and remove links to the list, check that the list is empty.
sl@0
    23
// - Create TSglQueBase object with and without an offset, verify offset, head 
sl@0
    24
// and last member values are correct.
sl@0
    25
// - Create TSglQueBase object, insert links using DoAddFirst and DoAddLast and
sl@0
    26
// remove links using DoRemove, check the results are as expected.
sl@0
    27
// - Create TSglQueBase object, insert links using DoAddFirst and DoAddLast and
sl@0
    28
// verify IsEmpty return the correct value. Set and verify the offset.
sl@0
    29
// - Create TSglQue object, insert TSglQueLink link at front and end of list, test 
sl@0
    30
// whether the links are inserted at specified location, remove some links.
sl@0
    31
// - Create TSglQue object, insert links using DoAddFirst and DoAddLast and
sl@0
    32
// remove links using DoRemove, check the results are as expected.
sl@0
    33
// - Create TSglQue object, insert links using DoAddFirst and DoAddLast and
sl@0
    34
// verify IsEmpty return the correct value. Set and verify the offset.
sl@0
    35
// - Create TSglQue object with and without an offset, verify offset, head 
sl@0
    36
// and last member values are correct.
sl@0
    37
// - Create TSglQue object, insert links using AddFirst and AddLast and
sl@0
    38
// verify results are as expected.
sl@0
    39
// - Create TSglQue object, insert links using AddFirst and AddLast and
sl@0
    40
// verify results using IsFirst and IsLast are as expected.
sl@0
    41
// - Create TSglQue object, insert links using AddFirst and AddLast and
sl@0
    42
// verify results using First and Last are as expected.
sl@0
    43
// - Create TSglQue object, insert links using AddLast and delete using Remove,
sl@0
    44
// verify results are as expected.
sl@0
    45
// - Create TSglQueIterBase object, with and without an offset, call the 
sl@0
    46
// DoCurrent, DoPostInc and SetToFirst methods.
sl@0
    47
// - Create TSglQueIterBase object, with and without an offset, and TSglQue 
sl@0
    48
// with different offsets, verify results are as expected.
sl@0
    49
// - Create TSglQueIterBase object, , with and without an offset, use the 
sl@0
    50
// DoCurrent and DoPostInc methods and verify the results are as expected.
sl@0
    51
// - Create TSglQueIterBase object, , with and without an offset, use the 
sl@0
    52
// DoPostInc and SetToFirst methods and verify the results are as expected.
sl@0
    53
// - Create TSglQueIter object, with and without an offset, iterate using 
sl@0
    54
// the ++ operator and delete the object.
sl@0
    55
// - Create TSglQueIter object, with and without an offset, and TSglQue 
sl@0
    56
// object with different offsets, verify results are as expected.
sl@0
    57
// - Create TSglQueIter object, with and without an offset, use the 
sl@0
    58
// DoCurrent and DoPostInc methods and verify the results are as expected.
sl@0
    59
// - Create TSglQueIter object, with and without an offset, use the 
sl@0
    60
// DoPostInc and SetToFirst methods and verify the results are as expected.
sl@0
    61
// - Create TSglQueIter object, with and without an offset, iterate using 
sl@0
    62
// the ++ operator, use the conversion operator, verify the results are 
sl@0
    63
// as expected.
sl@0
    64
// Platforms/Drives/Compatibility:
sl@0
    65
// All 
sl@0
    66
// Assumptions/Requirement/Pre-requisites:
sl@0
    67
// Failures and causes:
sl@0
    68
// Base Port information:
sl@0
    69
// 
sl@0
    70
//
sl@0
    71
sl@0
    72
#include <e32base.h>
sl@0
    73
#include <e32base_private.h>
sl@0
    74
#include <e32test.h>
sl@0
    75
sl@0
    76
LOCAL_D RTest test(_L("T_SQUE"));
sl@0
    77
sl@0
    78
#define SIZE 10
sl@0
    79
#define MAX_OFFSET 10
sl@0
    80
sl@0
    81
struct Item
sl@0
    82
	{
sl@0
    83
	TSglQueLink iLink;
sl@0
    84
	TInt iSpace[MAX_OFFSET]; // Reserve some space
sl@0
    85
	};
sl@0
    86
sl@0
    87
struct ItemWithOffset
sl@0
    88
	{
sl@0
    89
	TInt iSpace[MAX_OFFSET];
sl@0
    90
	TSglQueLink iLink;
sl@0
    91
	};
sl@0
    92
sl@0
    93
template<class T>
sl@0
    94
class TestTQueLink
sl@0
    95
	{
sl@0
    96
public:
sl@0
    97
	void TestQueLink();	// Calls Test: 1
sl@0
    98
	void Test1();
sl@0
    99
protected:
sl@0
   100
	void CreateObjects(TInt aBaseLink);
sl@0
   101
	void DestroyObjects();
sl@0
   102
private:
sl@0
   103
	T* iLink[SIZE];
sl@0
   104
	};
sl@0
   105
sl@0
   106
template<class T>
sl@0
   107
void TestTQueLink<T>::CreateObjects(TInt aBaseLink)
sl@0
   108
	{
sl@0
   109
	TInt i;
sl@0
   110
sl@0
   111
	for (i=0;i<SIZE;i++)
sl@0
   112
		iLink[i]=new T;
sl@0
   113
	if (aBaseLink>=0&&aBaseLink<SIZE)
sl@0
   114
		(iLink[aBaseLink])->iNext=iLink[aBaseLink];
sl@0
   115
	}
sl@0
   116
sl@0
   117
template<class T>
sl@0
   118
void TestTQueLink<T>::DestroyObjects()
sl@0
   119
	{
sl@0
   120
	TInt i;
sl@0
   121
sl@0
   122
	for (i=0;i<SIZE;i++)
sl@0
   123
		delete iLink[i];
sl@0
   124
	}
sl@0
   125
sl@0
   126
template <class T>
sl@0
   127
void TestTQueLink<T>::TestQueLink()
sl@0
   128
	{
sl@0
   129
	test.Start(_L("Test Enque"));
sl@0
   130
	Test1();
sl@0
   131
	test.Next(_L("Finished"));
sl@0
   132
	test.End();
sl@0
   133
	}
sl@0
   134
sl@0
   135
template<class T>
sl@0
   136
void TestTQueLink<T>::Test1()
sl@0
   137
	{
sl@0
   138
	test.Start(_L("Create objects"));
sl@0
   139
	CreateObjects(1);
sl@0
   140
	test.Next(_L("Destroy objects"));
sl@0
   141
	DestroyObjects();
sl@0
   142
	test.End();
sl@0
   143
	}
sl@0
   144
sl@0
   145
class VSglQueBase : public TSglQueBase
sl@0
   146
	{
sl@0
   147
public:
sl@0
   148
	inline VSglQueBase();
sl@0
   149
	inline VSglQueBase(TInt anOffset);
sl@0
   150
	inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);}
sl@0
   151
	inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);}
sl@0
   152
	inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);}
sl@0
   153
public:
sl@0
   154
	TSglQueLink** sHead;
sl@0
   155
	TSglQueLink** sLast;
sl@0
   156
	TInt* sOffset;
sl@0
   157
private:
sl@0
   158
	void SetMembers();
sl@0
   159
	};
sl@0
   160
sl@0
   161
template <class T>
sl@0
   162
class VSglQue : public TSglQue<T>
sl@0
   163
	{
sl@0
   164
public:
sl@0
   165
	inline VSglQue();
sl@0
   166
	inline VSglQue(TInt anOffset);
sl@0
   167
	inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);}
sl@0
   168
	inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);}
sl@0
   169
	inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);}
sl@0
   170
public:
sl@0
   171
	TSglQueLink** sHead;
sl@0
   172
	TSglQueLink** sLast;
sl@0
   173
	TInt* sOffset;
sl@0
   174
private:
sl@0
   175
	void SetMembers();
sl@0
   176
	};
sl@0
   177
sl@0
   178
inline VSglQueBase::VSglQueBase()
sl@0
   179
	{
sl@0
   180
	SetMembers();
sl@0
   181
	}
sl@0
   182
sl@0
   183
inline VSglQueBase::VSglQueBase(TInt anOffset)
sl@0
   184
	:TSglQueBase(anOffset)
sl@0
   185
	{
sl@0
   186
	SetMembers();
sl@0
   187
	}
sl@0
   188
sl@0
   189
void VSglQueBase::SetMembers()
sl@0
   190
	{
sl@0
   191
	sHead=&iHead;
sl@0
   192
	sLast=&iLast;
sl@0
   193
	sOffset=&iOffset;
sl@0
   194
	}
sl@0
   195
sl@0
   196
template <class T>
sl@0
   197
VSglQue<T>::VSglQue()
sl@0
   198
	{
sl@0
   199
	SetMembers();
sl@0
   200
	}
sl@0
   201
sl@0
   202
template <class T>
sl@0
   203
VSglQue<T>::VSglQue(TInt anOffset)
sl@0
   204
	:TSglQue<T>(anOffset)
sl@0
   205
	{
sl@0
   206
	SetMembers();
sl@0
   207
	}
sl@0
   208
sl@0
   209
template <class T>
sl@0
   210
void VSglQue<T>::SetMembers()
sl@0
   211
	{
sl@0
   212
	sHead=&this->iHead;
sl@0
   213
	sLast=&this->iLast;
sl@0
   214
	sOffset=&this->iOffset;
sl@0
   215
	}
sl@0
   216
sl@0
   217
template<class T>
sl@0
   218
class TestTQue
sl@0
   219
	{
sl@0
   220
public:
sl@0
   221
	void TestQueBase();
sl@0
   222
	void TestSglQue();
sl@0
   223
	void Test1();	// All functions		//TSglQueBase functions
sl@0
   224
	void Test2();	// Constructors
sl@0
   225
	void Test3();	// DoAdd's
sl@0
   226
	void Test4();	// Public functions
sl@0
   227
	void Test5();	// All functions		//TSglQue
sl@0
   228
	//void Test6();	// Constructors
sl@0
   229
	void Test7();	// Add's
sl@0
   230
	void Test8();	// Is's
sl@0
   231
	void Test9();	// Get's
sl@0
   232
	void Test10();	// Add's
sl@0
   233
private:
sl@0
   234
	void CallTest3_4();	
sl@0
   235
	};
sl@0
   236
sl@0
   237
template<class T>
sl@0
   238
void TestTQue<T>::CallTest3_4()
sl@0
   239
	{
sl@0
   240
	test.Next(_L("Test DoAdd's"));
sl@0
   241
	Test3();
sl@0
   242
	test.Next(_L("Test public functions"));
sl@0
   243
	Test4();
sl@0
   244
	}
sl@0
   245
sl@0
   246
template<class T>
sl@0
   247
void TestTQue<T>::TestQueBase()
sl@0
   248
	{
sl@0
   249
	test.Start(_L("Test all member functions (simply)"));
sl@0
   250
	Test1();						 
sl@0
   251
	test.Next(_L("Test Constructors"));
sl@0
   252
	Test2();
sl@0
   253
	CallTest3_4();
sl@0
   254
	test.Next(_L("Finished"));
sl@0
   255
	test.End();
sl@0
   256
	}
sl@0
   257
sl@0
   258
template<class T>
sl@0
   259
void TestTQue<T>::TestSglQue()
sl@0
   260
	{
sl@0
   261
	test.Start(_L("Test all member functions (simply)"));
sl@0
   262
	Test5();
sl@0
   263
	test.Next(_L("Test Super Class functions"));
sl@0
   264
	CallTest3_4();
sl@0
   265
	test.Next(_L("Test Constructors"));
sl@0
   266
	Test2();
sl@0
   267
	test.Next(_L("Test Add's"));
sl@0
   268
	Test7();
sl@0
   269
	test.Next(_L("Test Is's"));
sl@0
   270
	Test8();
sl@0
   271
	test.Next(_L("Test Get's"));
sl@0
   272
	Test9();
sl@0
   273
	test.Next(_L("Test Remove"));
sl@0
   274
	Test10();
sl@0
   275
	test.Next(_L("Finished"));
sl@0
   276
	test.End();
sl@0
   277
	}
sl@0
   278
sl@0
   279
template<class T>
sl@0
   280
void TestTQue<T>::Test1()
sl@0
   281
	{
sl@0
   282
	T* que;
sl@0
   283
	TSglQueLink link1,link2;
sl@0
   284
	TInt offset=4;
sl@0
   285
sl@0
   286
	test.Start(_L("Constructors"));
sl@0
   287
	que=new VSglQueBase(offset);
sl@0
   288
	delete que;
sl@0
   289
	que=new VSglQueBase;
sl@0
   290
	//delete que;
sl@0
   291
	test.Next(_L("DoAdd's"));
sl@0
   292
	que->sDoAddFirst(&link1);
sl@0
   293
	que->sDoAddLast(&link2);
sl@0
   294
	que->sDoRemove(&link1);
sl@0
   295
	que->sDoRemove(&link2);
sl@0
   296
	test.Next(_L("Public"));
sl@0
   297
	que->IsEmpty();
sl@0
   298
	que->SetOffset(offset);
sl@0
   299
	test.Next(_L("Finished"));
sl@0
   300
	delete que;
sl@0
   301
	test.End();
sl@0
   302
	}
sl@0
   303
sl@0
   304
template<class T>
sl@0
   305
void TestTQue<T>::Test2()
sl@0
   306
	{
sl@0
   307
	T* que;
sl@0
   308
	TInt offset;
sl@0
   309
sl@0
   310
	test.Start(_L("Default constructor"));
sl@0
   311
	que=new T();
sl@0
   312
	test(*(que->sOffset)==0);
sl@0
   313
	test(*(que->sHead)==NULL);
sl@0
   314
	test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   315
	delete que;
sl@0
   316
	test.Next(_L("Offset constructor"));
sl@0
   317
	for (offset=0;offset<40;offset+=4)
sl@0
   318
		{
sl@0
   319
		que=new T(offset);
sl@0
   320
		test(*(que->sOffset)==offset);
sl@0
   321
		test(*(que->sHead)==NULL);
sl@0
   322
		test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   323
		delete que;
sl@0
   324
		}
sl@0
   325
	test.Next(_L("Finished"));
sl@0
   326
	test.End();
sl@0
   327
	}
sl@0
   328
sl@0
   329
template<class T>
sl@0
   330
void TestTQue<T>::Test3()
sl@0
   331
	{
sl@0
   332
	T* que;
sl@0
   333
sl@0
   334
		{
sl@0
   335
		TSglQueLink link1,link2,link3,link4;
sl@0
   336
		test.Start(_L("AddFirst"));
sl@0
   337
		que=new T();
sl@0
   338
		test(*(que->sHead)==NULL);
sl@0
   339
		test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   340
		que->sDoAddFirst(&link1);
sl@0
   341
		test(*(que->sHead)==&link1);
sl@0
   342
		test(*(que->sLast)==&link1);
sl@0
   343
		test(link1.iNext==NULL);
sl@0
   344
		que->sDoAddFirst(&link2);
sl@0
   345
		test(*(que->sHead)==&link2);
sl@0
   346
		test(*(que->sLast)==&link1);
sl@0
   347
		test(link1.iNext==NULL);
sl@0
   348
		test(link2.iNext==&link1);
sl@0
   349
		que->sDoAddFirst(&link3);
sl@0
   350
		test(*(que->sHead)==&link3);
sl@0
   351
		test(*(que->sLast)==&link1);
sl@0
   352
		test(link1.iNext==NULL);
sl@0
   353
		test(link2.iNext==&link1);
sl@0
   354
		test(link3.iNext==&link2);
sl@0
   355
		que->sDoAddFirst(&link4);
sl@0
   356
		test(*(que->sHead)==&link4);
sl@0
   357
		test(*(que->sLast)==&link1);
sl@0
   358
		test(link1.iNext==NULL);
sl@0
   359
		test(link2.iNext==&link1);
sl@0
   360
		test(link3.iNext==&link2);
sl@0
   361
		test(link4.iNext==&link3);
sl@0
   362
		delete que;
sl@0
   363
		}
sl@0
   364
	TSglQueLink link1,link2,link3,link4;
sl@0
   365
	test.Next(_L("AddLast"));
sl@0
   366
	que=new T();
sl@0
   367
	test(*(que->sHead)==NULL);
sl@0
   368
	test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   369
	que->sDoAddLast(&link1);
sl@0
   370
	test(*(que->sHead)==&link1);
sl@0
   371
	test(*(que->sLast)==&link1);
sl@0
   372
	test(link1.iNext==NULL);
sl@0
   373
	que->sDoAddLast(&link2);
sl@0
   374
	test(*(que->sHead)==&link1);
sl@0
   375
	test(*(que->sLast)==&link2);
sl@0
   376
	test(link1.iNext==&link2);
sl@0
   377
	test(link2.iNext==NULL);
sl@0
   378
	que->sDoAddLast(&link3);
sl@0
   379
	test(*(que->sHead)==&link1);
sl@0
   380
	test(*(que->sLast)==&link3);
sl@0
   381
	test(link1.iNext==&link2);
sl@0
   382
	test(link2.iNext==&link3);
sl@0
   383
	test(link3.iNext==NULL);
sl@0
   384
	que->sDoAddLast(&link4);
sl@0
   385
	test(*(que->sHead)==&link1);
sl@0
   386
	test(*(que->sLast)==&link4);
sl@0
   387
	test(link1.iNext==&link2);
sl@0
   388
	test(link2.iNext==&link3);
sl@0
   389
	test(link3.iNext==&link4);
sl@0
   390
	test(link4.iNext==NULL);
sl@0
   391
	test.Next(_L("Remove"));
sl@0
   392
	que->sDoRemove(&link3);
sl@0
   393
	test(*(que->sHead)==&link1);
sl@0
   394
	test(*(que->sLast)==&link4);
sl@0
   395
	test(link1.iNext==&link2);
sl@0
   396
	test(link2.iNext==&link4);
sl@0
   397
	test(link4.iNext==NULL);
sl@0
   398
	que->sDoRemove(&link4);
sl@0
   399
	test(*(que->sHead)==&link1);
sl@0
   400
	test(*(que->sLast)==&link2);
sl@0
   401
	test(link1.iNext==&link2);
sl@0
   402
	test(link2.iNext==NULL);
sl@0
   403
	que->sDoRemove(&link1);
sl@0
   404
	test(*(que->sHead)==&link2);
sl@0
   405
	test(*(que->sLast)==&link2);
sl@0
   406
	test(link2.iNext==NULL);
sl@0
   407
	que->sDoRemove(&link2);
sl@0
   408
	test(*(que->sHead)==NULL);
sl@0
   409
	test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   410
 	delete que;
sl@0
   411
	test.Next(_L("Finished"));
sl@0
   412
	test.End();
sl@0
   413
	}
sl@0
   414
sl@0
   415
template<class T>
sl@0
   416
void TestTQue<T>::Test4()
sl@0
   417
	{
sl@0
   418
	T* que;
sl@0
   419
	TInt offset;
sl@0
   420
sl@0
   421
	test.Start(_L("IsEmpty"));
sl@0
   422
	que=new T();
sl@0
   423
	test(que->IsEmpty()==TRUE);
sl@0
   424
	TSglQueLink link1,link2;
sl@0
   425
	que->sDoAddFirst(&link1);
sl@0
   426
	test(que->IsEmpty()==FALSE);
sl@0
   427
	que->sDoRemove(&link1);
sl@0
   428
	test(que->IsEmpty()==TRUE);
sl@0
   429
	que->sDoAddLast(&link2);
sl@0
   430
	test(que->IsEmpty()==FALSE);
sl@0
   431
	que->sDoAddFirst(&link1);
sl@0
   432
	test(que->IsEmpty()==FALSE);
sl@0
   433
	que->sDoRemove(&link2);
sl@0
   434
	test(que->IsEmpty()==FALSE);
sl@0
   435
	que->sDoRemove(&link1);
sl@0
   436
	test(que->IsEmpty()==TRUE);
sl@0
   437
	test.Next(_L("SetOffset"));
sl@0
   438
	for (offset=0;offset<40;offset+=4)
sl@0
   439
		{
sl@0
   440
		que->SetOffset(offset);
sl@0
   441
		test(*(que->sOffset)==offset);
sl@0
   442
		}
sl@0
   443
	test.Next(_L("Finished"));
sl@0
   444
 	delete que;
sl@0
   445
	test.End();
sl@0
   446
	}
sl@0
   447
sl@0
   448
template<class T>
sl@0
   449
void TestTQue<T>::Test5()
sl@0
   450
	{
sl@0
   451
	T* que;
sl@0
   452
	TSglQueLink link1,link2;
sl@0
   453
	TInt offset=4;
sl@0
   454
sl@0
   455
	test.Start(_L("Constructors"));
sl@0
   456
	que=new VSglQue<TSglQueLink>(offset);
sl@0
   457
	delete que;
sl@0
   458
	que=new VSglQue<TSglQueLink>;
sl@0
   459
	test.Next(_L("Add's"));
sl@0
   460
	que->AddFirst(link1);
sl@0
   461
	que->AddLast(link2);
sl@0
   462
	test.Next(_L("Is's"));
sl@0
   463
	que->IsFirst(&link1);
sl@0
   464
	que->IsLast(&link1);
sl@0
   465
	test.Next(_L("Get's"));
sl@0
   466
	que->First();
sl@0
   467
	que->Last();
sl@0
   468
	test.Next(_L("Remove"));
sl@0
   469
	que->Remove(link1);
sl@0
   470
	que->Remove(link2);
sl@0
   471
	test.Next(_L("Finished"));
sl@0
   472
	delete que;
sl@0
   473
	test.End();
sl@0
   474
	}
sl@0
   475
sl@0
   476
/*template<class T>
sl@0
   477
void TestTQue<T>::Test6()
sl@0
   478
	{
sl@0
   479
	T* que;
sl@0
   480
	TInt offset;
sl@0
   481
sl@0
   482
	test.Start(_L("Default constructor"));
sl@0
   483
	que=new VSglQue<TSglQueBase>();
sl@0
   484
	test(*(que->sFirstDelta)==NULL);
sl@0
   485
	delete que;
sl@0
   486
	test.Next(_L("Offset constructor"));
sl@0
   487
	for (offset=0;offset<40;offset+=4)
sl@0
   488
		{
sl@0
   489
		que=new VDeltaQueBase(offset);
sl@0
   490
		test(*(que->sOffset)==offset);
sl@0
   491
		test(*(que->sFirstDelta)==NULL);
sl@0
   492
		delete que;
sl@0
   493
		}
sl@0
   494
	test.Next(_L("Finished"));
sl@0
   495
	test.End();
sl@0
   496
	}*/
sl@0
   497
sl@0
   498
template<class T>
sl@0
   499
void TestTQue<T>::Test7()
sl@0
   500
	{
sl@0
   501
	T* que;
sl@0
   502
sl@0
   503
		{
sl@0
   504
		TSglQueLink link1,link2,link3,link4;
sl@0
   505
		test.Start(_L("AddFirst"));
sl@0
   506
		que=new T();
sl@0
   507
		test(*(que->sHead)==NULL);
sl@0
   508
		test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   509
		que->AddFirst(link1);
sl@0
   510
		test(*(que->sHead)==&link1);
sl@0
   511
		test(*(que->sLast)==&link1);
sl@0
   512
		test(link1.iNext==NULL);
sl@0
   513
		que->AddFirst(link2);
sl@0
   514
		test(*(que->sHead)==&link2);
sl@0
   515
		test(*(que->sLast)==&link1);
sl@0
   516
		test(link1.iNext==NULL);
sl@0
   517
		test(link2.iNext==&link1);
sl@0
   518
		que->AddFirst(link3);
sl@0
   519
		test(*(que->sHead)==&link3);
sl@0
   520
		test(*(que->sLast)==&link1);
sl@0
   521
		test(link1.iNext==NULL);
sl@0
   522
		test(link2.iNext==&link1);
sl@0
   523
		test(link3.iNext==&link2);
sl@0
   524
		que->AddFirst(link4);
sl@0
   525
		test(*(que->sHead)==&link4);
sl@0
   526
		test(*(que->sLast)==&link1);
sl@0
   527
		test(link1.iNext==NULL);
sl@0
   528
		test(link2.iNext==&link1);
sl@0
   529
		test(link3.iNext==&link2);
sl@0
   530
		test(link4.iNext==&link3);
sl@0
   531
		delete que;
sl@0
   532
		}
sl@0
   533
	TSglQueLink link1,link2,link3,link4;
sl@0
   534
	test.Next(_L("AddLast"));
sl@0
   535
	que=new T();
sl@0
   536
	test.Next(_L("AddLast"));
sl@0
   537
	que=new T();
sl@0
   538
	test(*(que->sHead)==NULL);
sl@0
   539
	test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   540
	que->AddLast(link1);
sl@0
   541
	test(*(que->sHead)==&link1);
sl@0
   542
	test(*(que->sLast)==&link1);
sl@0
   543
	test(link1.iNext==NULL);
sl@0
   544
	que->AddLast(link2);
sl@0
   545
	test(*(que->sHead)==&link1);
sl@0
   546
	test(*(que->sLast)==&link2);
sl@0
   547
	test(link1.iNext==&link2);
sl@0
   548
	test(link2.iNext==NULL);
sl@0
   549
	que->AddLast(link3);
sl@0
   550
	test(*(que->sHead)==&link1);
sl@0
   551
	test(*(que->sLast)==&link3);
sl@0
   552
	test(link1.iNext==&link2);
sl@0
   553
	test(link2.iNext==&link3);
sl@0
   554
	test(link3.iNext==NULL);
sl@0
   555
	que->AddLast(link4);
sl@0
   556
	test(*(que->sHead)==&link1);
sl@0
   557
	test(*(que->sLast)==&link4);
sl@0
   558
	test(link1.iNext==&link2);
sl@0
   559
	test(link2.iNext==&link3);
sl@0
   560
	test(link3.iNext==&link4);
sl@0
   561
	test(link4.iNext==NULL);
sl@0
   562
	delete que;
sl@0
   563
	test.Next(_L("Finished"));
sl@0
   564
	test.End();
sl@0
   565
	}
sl@0
   566
sl@0
   567
template<class T>
sl@0
   568
void TestTQue<T>::Test8()
sl@0
   569
	{
sl@0
   570
	T* que;
sl@0
   571
sl@0
   572
		{
sl@0
   573
		TSglQueLink link1,link2,link3,link4;
sl@0
   574
		test.Start(_L("IsFirst"));
sl@0
   575
		que=new T();
sl@0
   576
		test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
sl@0
   577
		test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   578
		test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
sl@0
   579
		que->AddFirst(link1);
sl@0
   580
		test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
sl@0
   581
		test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   582
		test(que->IsFirst((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   583
		test(que->IsFirst(&link1)==TRUE);
sl@0
   584
		que->AddFirst(link2);
sl@0
   585
		test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
sl@0
   586
		test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   587
		test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
sl@0
   588
		test(que->IsFirst(&link1)==FALSE);
sl@0
   589
		test(que->IsFirst(&link2)==TRUE);
sl@0
   590
		que->AddFirst(link3);
sl@0
   591
		test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
sl@0
   592
		test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   593
		test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
sl@0
   594
		test(que->IsFirst(&link1)==FALSE);
sl@0
   595
		test(que->IsFirst(&link2)==FALSE);
sl@0
   596
		test(que->IsFirst(&link3)==TRUE);
sl@0
   597
		que->AddFirst(link4);
sl@0
   598
		test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
sl@0
   599
		test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   600
		test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
sl@0
   601
		test(que->IsFirst(&link1)==FALSE);
sl@0
   602
		test(que->IsFirst(&link2)==FALSE);
sl@0
   603
		test(que->IsFirst(&link3)==FALSE);
sl@0
   604
		test(que->IsFirst(&link4)==TRUE);
sl@0
   605
		delete que;
sl@0
   606
		}
sl@0
   607
	TSglQueLink link1,link2,link3,link4;
sl@0
   608
	test.Next(_L("IsLast"));
sl@0
   609
	que=new T();
sl@0
   610
	test(que->IsLast((TSglQueLink*) que->sHead)==TRUE);
sl@0
   611
	test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
sl@0
   612
	test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   613
	que->AddLast(link1);
sl@0
   614
	test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
sl@0
   615
	test(que->IsLast((TSglQueLink*) *(que->sHead))==TRUE);
sl@0
   616
	test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   617
	test(que->IsLast(&link1)==TRUE);
sl@0
   618
	que->AddLast(link2);
sl@0
   619
	test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
sl@0
   620
	test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
sl@0
   621
	test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   622
	test(que->IsLast(&link1)==FALSE);
sl@0
   623
	test(que->IsLast(&link2)==TRUE);
sl@0
   624
	que->AddLast(link3);
sl@0
   625
	test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
sl@0
   626
	test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
sl@0
   627
	test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   628
	test(que->IsLast(&link1)==FALSE);
sl@0
   629
	test(que->IsLast(&link2)==FALSE);
sl@0
   630
	test(que->IsLast(&link3)==TRUE);
sl@0
   631
	que->AddLast(link4);
sl@0
   632
	test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
sl@0
   633
	test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
sl@0
   634
	test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
sl@0
   635
	test(que->IsLast(&link1)==FALSE);
sl@0
   636
	test(que->IsLast(&link2)==FALSE);
sl@0
   637
	test(que->IsLast(&link3)==FALSE);
sl@0
   638
	test(que->IsLast(&link4)==TRUE);
sl@0
   639
	test.Next(_L("Finished"));
sl@0
   640
	delete que;
sl@0
   641
	test.End();
sl@0
   642
	}
sl@0
   643
sl@0
   644
template<class T>
sl@0
   645
void TestTQue<T>::Test9()
sl@0
   646
	{
sl@0
   647
	T* que;
sl@0
   648
sl@0
   649
		{
sl@0
   650
		TSglQueLink link1,link2,link3,link4;
sl@0
   651
		test.Start(_L("First"));
sl@0
   652
		que=new T();
sl@0
   653
		test(que->First()==NULL);
sl@0
   654
		que->AddFirst(link1);
sl@0
   655
		test(que->First()==&link1);
sl@0
   656
	 	que->AddFirst(link2);
sl@0
   657
		test(que->First()==&link2);
sl@0
   658
	 	que->AddFirst(link3);
sl@0
   659
		test(que->First()==&link3);
sl@0
   660
	  	que->AddFirst(link4);
sl@0
   661
		test(que->First()==&link4);
sl@0
   662
	 	delete que;
sl@0
   663
		}
sl@0
   664
	TSglQueLink link1,link2,link3,link4;
sl@0
   665
	test.Next(_L("Last"));
sl@0
   666
	que=new T();
sl@0
   667
	test(que->Last()==(TSglQueLink*) que->sHead);
sl@0
   668
	que->AddLast(link1);
sl@0
   669
	test(que->Last()==&link1);
sl@0
   670
 	que->AddLast(link2);
sl@0
   671
	test(que->Last()==&link2);
sl@0
   672
 	que->AddLast(link3);
sl@0
   673
	test(que->Last()==&link3);
sl@0
   674
  	que->AddLast(link4);
sl@0
   675
	test(que->Last()==&link4);
sl@0
   676
	test.Next(_L("Finished"));
sl@0
   677
 	delete que;
sl@0
   678
	test.End();
sl@0
   679
	}
sl@0
   680
sl@0
   681
template<class T>
sl@0
   682
void TestTQue<T>::Test10()
sl@0
   683
	{
sl@0
   684
	T* que;
sl@0
   685
	TSglQueLink link1,link2,link3,link4;
sl@0
   686
sl@0
   687
	que=new T();
sl@0
   688
	que->AddLast(link1);
sl@0
   689
	que->AddLast(link2);
sl@0
   690
	que->AddLast(link3);
sl@0
   691
	que->AddLast(link4);
sl@0
   692
	test(*(que->sHead)==&link1);
sl@0
   693
	test(*(que->sLast)==&link4);
sl@0
   694
	test(link1.iNext==&link2);
sl@0
   695
	test(link2.iNext==&link3);
sl@0
   696
	test(link3.iNext==&link4);
sl@0
   697
	test(link4.iNext==NULL);
sl@0
   698
	que->Remove(link3);
sl@0
   699
	test(*(que->sHead)==&link1);
sl@0
   700
	test(*(que->sLast)==&link4);
sl@0
   701
	test(link1.iNext==&link2);
sl@0
   702
	test(link2.iNext==&link4);
sl@0
   703
	test(link4.iNext==NULL);
sl@0
   704
	que->Remove(link4);
sl@0
   705
	test(*(que->sHead)==&link1);
sl@0
   706
	test(*(que->sLast)==&link2);
sl@0
   707
	test(link1.iNext==&link2);
sl@0
   708
	test(link2.iNext==NULL);
sl@0
   709
	que->Remove(link1);
sl@0
   710
	test(*(que->sHead)==&link2);
sl@0
   711
	test(*(que->sLast)==&link2);
sl@0
   712
	test(link2.iNext==NULL);
sl@0
   713
	que->Remove(link2);
sl@0
   714
	test(*(que->sHead)==NULL);
sl@0
   715
	test(*(que->sLast)==(TSglQueLink*) que->sHead);
sl@0
   716
 	delete que;
sl@0
   717
	}
sl@0
   718
sl@0
   719
class VSglQueIterBase : public TSglQueIterBase
sl@0
   720
	{
sl@0
   721
public:
sl@0
   722
	VSglQueIterBase(TSglQueBase& aQue);
sl@0
   723
	inline TAny* sDoPostInc() {return DoPostInc();}
sl@0
   724
	inline TAny* sDoCurrent() {return DoCurrent();}
sl@0
   725
public:
sl@0
   726
	TInt* sOffset;
sl@0
   727
	TSglQueLink** sHead;
sl@0
   728
	TSglQueLink** sNext;
sl@0
   729
private:
sl@0
   730
	void SetMember();
sl@0
   731
	};
sl@0
   732
sl@0
   733
template <class T>
sl@0
   734
class VSglQueIter : public TSglQueIter<T>
sl@0
   735
	{
sl@0
   736
public:
sl@0
   737
	VSglQueIter(TSglQue<T>& aQue);
sl@0
   738
	inline TAny* sDoPostInc() {return this->DoPostInc();}
sl@0
   739
	inline TAny* sDoCurrent() {return this->DoCurrent();}
sl@0
   740
public:
sl@0
   741
	TInt* sOffset;
sl@0
   742
	TSglQueLink** sHead;
sl@0
   743
	TSglQueLink** sNext;
sl@0
   744
private:
sl@0
   745
	void SetMember();
sl@0
   746
	};
sl@0
   747
sl@0
   748
VSglQueIterBase::VSglQueIterBase(TSglQueBase& aQue)
sl@0
   749
	:TSglQueIterBase(aQue)
sl@0
   750
	{
sl@0
   751
	SetMember();
sl@0
   752
	}
sl@0
   753
sl@0
   754
void VSglQueIterBase::SetMember()
sl@0
   755
	{
sl@0
   756
	sOffset=&iOffset;
sl@0
   757
	sHead=&iHead;
sl@0
   758
	sNext=&iNext;
sl@0
   759
	}
sl@0
   760
sl@0
   761
template <class T>
sl@0
   762
VSglQueIter<T>::VSglQueIter(TSglQue<T>& aQue)
sl@0
   763
	:TSglQueIter<T>(aQue)
sl@0
   764
	{
sl@0
   765
	SetMember();
sl@0
   766
	}
sl@0
   767
sl@0
   768
template <class T>
sl@0
   769
void VSglQueIter<T>::SetMember()
sl@0
   770
	{
sl@0
   771
	sOffset=&this->iOffset;
sl@0
   772
	sHead=&this->iHead;
sl@0
   773
	sNext=&this->iNext;
sl@0
   774
	}
sl@0
   775
	
sl@0
   776
template<class T,class Iter>
sl@0
   777
class TestTQueIter
sl@0
   778
	{
sl@0
   779
public:
sl@0
   780
	void TestIterBase();
sl@0
   781
	void TestQueIter();
sl@0
   782
	void Test1();	//All functions			//TSglQueIterBase
sl@0
   783
	void Test2();	//Constructor
sl@0
   784
	void Test3();	//Do's
sl@0
   785
	void Test4();	//Set
sl@0
   786
	void Test5();	//All functions			//TDblQueIter
sl@0
   787
	//void Test6();	//Constructors									//Redundant
sl@0
   788
	void Test7();	//Iterators
sl@0
   789
private:
sl@0
   790
	void CallTest2_4();
sl@0
   791
	};
sl@0
   792
sl@0
   793
template<class T,class Iter>
sl@0
   794
void TestTQueIter<T,Iter>::CallTest2_4()
sl@0
   795
	{
sl@0
   796
	test.Next(_L("Constructors"));
sl@0
   797
	Test2();
sl@0
   798
	test.Next(_L("Do's"));
sl@0
   799
	Test3();
sl@0
   800
	test.Next(_L("Sets"));
sl@0
   801
	Test4();
sl@0
   802
	}
sl@0
   803
sl@0
   804
template<class T,class Iter>
sl@0
   805
void TestTQueIter<T,Iter>::TestIterBase()
sl@0
   806
	{
sl@0
   807
	test.Start(_L("All Methods"));
sl@0
   808
	Test1();
sl@0
   809
	CallTest2_4();
sl@0
   810
	test.Next(_L("Finished"));
sl@0
   811
	test.End();
sl@0
   812
	}
sl@0
   813
sl@0
   814
template<class T,class Iter>
sl@0
   815
void TestTQueIter<T,Iter>::TestQueIter()
sl@0
   816
	{
sl@0
   817
	test.Start(_L("All Methods"));
sl@0
   818
	Test5();
sl@0
   819
	CallTest2_4();
sl@0
   820
	test.Next(_L("Iterators"));
sl@0
   821
	Test7();
sl@0
   822
	test.Next(_L("Finished"));
sl@0
   823
	test.End();
sl@0
   824
	}
sl@0
   825
sl@0
   826
template<class T,class Iter>
sl@0
   827
void TestTQueIter<T,Iter>::Test1()
sl@0
   828
	{
sl@0
   829
	T item1,item2;
sl@0
   830
	TSglQue<T> que(_FOFF(T,iLink));
sl@0
   831
	Iter* iter;
sl@0
   832
sl@0
   833
	que.AddFirst(item2);
sl@0
   834
	que.AddFirst(item1);
sl@0
   835
	test.Start(_L("Constructor"));
sl@0
   836
	iter=new Iter(que);
sl@0
   837
	test.Next(_L("Do's"));
sl@0
   838
	iter->sDoCurrent();
sl@0
   839
	iter->sDoPostInc();
sl@0
   840
	test.Next(_L("Sets"));
sl@0
   841
	iter->SetToFirst();
sl@0
   842
	delete iter;
sl@0
   843
	test.Next(_L("Finished"));
sl@0
   844
	test.End();
sl@0
   845
	}
sl@0
   846
sl@0
   847
template<class T,class Iter>
sl@0
   848
void TestTQueIter<T,Iter>::Test2()
sl@0
   849
	{
sl@0
   850
	TSglQue<T>* que;
sl@0
   851
	TInt offset;
sl@0
   852
 	Iter* iter;
sl@0
   853
	TSglQueLink* head;
sl@0
   854
sl@0
   855
	for (offset=0;offset<40;offset+=4)
sl@0
   856
		{
sl@0
   857
		que=new TSglQue<T>(offset);
sl@0
   858
		iter=new Iter(*que);
sl@0
   859
		test(*(iter->sHead)==PtrAdd((TSglQueLink*) que->Last(),offset));
sl@0
   860
		head=*(iter->sHead);
sl@0
   861
		test(que->IsFirst((T*) PtrSub(*(iter->sNext),offset)));		//Need to pass a pointer to a item
sl@0
   862
		test(*(iter->sOffset)==offset);
sl@0
   863
		delete iter;
sl@0
   864
		T item;
sl@0
   865
		que->AddFirst(item);
sl@0
   866
		iter=new Iter(*que);
sl@0
   867
		test(*(iter->sHead)==head);
sl@0
   868
		test(que->IsFirst((T*) PtrSub(*(iter->sNext),offset)));
sl@0
   869
		test(*(iter->sOffset)==offset);
sl@0
   870
		delete iter;
sl@0
   871
		delete que;
sl@0
   872
		}
sl@0
   873
	}
sl@0
   874
sl@0
   875
template<class T,class Iter>
sl@0
   876
void TestTQueIter<T,Iter>::Test3()
sl@0
   877
	{
sl@0
   878
	T item1,item2,item3,item4;
sl@0
   879
	TSglQue<T> que(_FOFF(T,iLink));
sl@0
   880
 	Iter* iter;
sl@0
   881
				  
sl@0
   882
	que.AddFirst(item4);
sl@0
   883
	que.AddFirst(item3);
sl@0
   884
	que.AddFirst(item2);
sl@0
   885
	que.AddFirst(item1);
sl@0
   886
	test.Start(_L("DoPostInc"));
sl@0
   887
	iter=new Iter(que);
sl@0
   888
	test(&item1==iter->sDoPostInc());
sl@0
   889
	test(&item2.iLink==*(iter->sNext));
sl@0
   890
	test(&item2==iter->sDoPostInc());
sl@0
   891
	test(&item3.iLink==*(iter->sNext));
sl@0
   892
	test(&item3==iter->sDoPostInc());
sl@0
   893
	test(&item4.iLink==*(iter->sNext));
sl@0
   894
	test(&item4==iter->sDoPostInc());
sl@0
   895
	test((Item*) *(iter->sNext)==NULL);
sl@0
   896
	test(iter->sDoPostInc()==NULL);
sl@0
   897
	delete iter;
sl@0
   898
	test.Next(_L("DoCurrent"));
sl@0
   899
	iter=new Iter(que);
sl@0
   900
	test(&item1==iter->sDoCurrent());
sl@0
   901
	iter->sDoPostInc();
sl@0
   902
	test(&item2==iter->sDoCurrent());
sl@0
   903
	iter->sDoPostInc();
sl@0
   904
	test(&item3==iter->sDoCurrent());
sl@0
   905
	iter->sDoPostInc();
sl@0
   906
	test(&item4==iter->sDoCurrent());
sl@0
   907
	iter->sDoPostInc();
sl@0
   908
	test(iter->sDoCurrent()==NULL);
sl@0
   909
	delete iter;
sl@0
   910
	test.Next(_L("Finished"));
sl@0
   911
	test.End();
sl@0
   912
	}
sl@0
   913
sl@0
   914
template<class T,class Iter>
sl@0
   915
void TestTQueIter<T,Iter>::Test4()
sl@0
   916
	{
sl@0
   917
	T item1,item2,item3,item4;
sl@0
   918
	TSglQue<T> que(_FOFF(T,iLink));
sl@0
   919
 	Iter* iter;
sl@0
   920
	TInt i,j;
sl@0
   921
sl@0
   922
	que.AddFirst(item4);
sl@0
   923
	que.AddFirst(item3);
sl@0
   924
	que.AddFirst(item2);
sl@0
   925
	que.AddFirst(item1);
sl@0
   926
	iter=new Iter(que);
sl@0
   927
	for(i=0;i<5;i++)
sl@0
   928
		{
sl@0
   929
		for(j=0;j<i;j++)
sl@0
   930
			iter->sDoPostInc();
sl@0
   931
		iter->SetToFirst();
sl@0
   932
		test(*(iter->sNext)==&item1.iLink);
sl@0
   933
		}
sl@0
   934
	delete iter;
sl@0
   935
	}
sl@0
   936
sl@0
   937
template<class T,class Iter>
sl@0
   938
void TestTQueIter<T,Iter>::Test5()
sl@0
   939
	{
sl@0
   940
	T item1,item2;
sl@0
   941
	TSglQue<T> que(_FOFF(T,iLink));
sl@0
   942
	Iter* iter;
sl@0
   943
	T* a;
sl@0
   944
sl@0
   945
	que.AddFirst(item2);
sl@0
   946
	que.AddFirst(item1);
sl@0
   947
	test.Start(_L("Constructor"));
sl@0
   948
	iter=new Iter(que);
sl@0
   949
	test.Next(_L("Iterators"));
sl@0
   950
	a=*iter;
sl@0
   951
	(*iter)++;
sl@0
   952
	delete iter;
sl@0
   953
	test.Next(_L("Finished"));
sl@0
   954
	test.End();
sl@0
   955
	}
sl@0
   956
sl@0
   957
/*template<class T>											//Redundant
sl@0
   958
void TestTQueIter<T>::Test6()
sl@0
   959
	{
sl@0
   960
	Item item;
sl@0
   961
	TDblQue<Item>* que;
sl@0
   962
	TInt offset;
sl@0
   963
 	T* iter;
sl@0
   964
sl@0
   965
	for (offset=0;offset<40;offset+=4)
sl@0
   966
		{
sl@0
   967
		que=new TDblQue<Item>(offset);
sl@0
   968
		iter=new T(*que);
sl@0
   969
		test(que->IsHead((Item*) *(iter->sHead)));
sl@0
   970
		test(que->IsHead((Item*) *(iter->sNext)));
sl@0
   971
		test(*(iter->sOffset)==offset);
sl@0
   972
		delete iter;
sl@0
   973
		delete que;
sl@0
   974
		que=new TDblQue<Item>(offset);
sl@0
   975
		que->AddFirst(item);
sl@0
   976
		iter=new T(*que);
sl@0
   977
		test(que->IsHead((Item*) *(iter->sHead)));
sl@0
   978
		test(*(iter->sNext)==&item.iLink);
sl@0
   979
		test(*(iter->sOffset)==offset);
sl@0
   980
		delete iter;
sl@0
   981
		delete que;
sl@0
   982
		}
sl@0
   983
	}*/
sl@0
   984
sl@0
   985
template<class T,class Iter>
sl@0
   986
void TestTQueIter<T,Iter>::Test7()
sl@0
   987
	{
sl@0
   988
	T item1,item2,item3,item4;
sl@0
   989
	TSglQue<T> que(_FOFF(T,iLink));
sl@0
   990
 	Iter* iter;
sl@0
   991
				  
sl@0
   992
	que.AddFirst(item4);
sl@0
   993
	que.AddFirst(item3);
sl@0
   994
	que.AddFirst(item2);
sl@0
   995
	que.AddFirst(item1);
sl@0
   996
	test.Start(_L("PostFix ++"));
sl@0
   997
	iter=new Iter(que);
sl@0
   998
	test(&item1==(*iter)++);
sl@0
   999
	test(&item2.iLink==*(iter->sNext));
sl@0
  1000
	test(&item2==(*iter)++);
sl@0
  1001
	test(&item3.iLink==*(iter->sNext));
sl@0
  1002
	test(&item3==(*iter)++);
sl@0
  1003
	test(&item4.iLink==*(iter->sNext));
sl@0
  1004
	test(&item4==(*iter)++);
sl@0
  1005
	test((Item*) *(iter->sNext)==NULL);
sl@0
  1006
	test((*iter)++==NULL);
sl@0
  1007
	delete iter;
sl@0
  1008
	test.Next(_L("Conversion Operator"));
sl@0
  1009
	iter=new Iter(que);
sl@0
  1010
	test(&item1==*iter);
sl@0
  1011
	(*iter)++;
sl@0
  1012
	test(&item2==*iter);
sl@0
  1013
	(*iter)++;
sl@0
  1014
	test(&item3==*iter);
sl@0
  1015
	(*iter)++;
sl@0
  1016
	test(&item4==*iter);
sl@0
  1017
	(*iter)++;
sl@0
  1018
	test(*iter==NULL);
sl@0
  1019
	delete iter;
sl@0
  1020
	test.Next(_L("Finished"));
sl@0
  1021
	test.End();
sl@0
  1022
	}
sl@0
  1023
	
sl@0
  1024
#ifndef _DEBUG
sl@0
  1025
#pragma warning (disable: 4710)
sl@0
  1026
#endif
sl@0
  1027
sl@0
  1028
GLDEF_C TInt E32Main()
sl@0
  1029
    {
sl@0
  1030
sl@0
  1031
	TestTQueLink<TSglQueLink>* testSglQueLink;
sl@0
  1032
	TestTQue<VSglQueBase>* testSglQueBase;
sl@0
  1033
	TestTQue<VSglQue<TSglQueLink> >* testSglQue;
sl@0
  1034
	TestTQueIter<Item,VSglQueIterBase>* testSglQueIterBase;
sl@0
  1035
	TestTQueIter<Item,VSglQueIter<Item> >* testSglQueIter;
sl@0
  1036
sl@0
  1037
	TestTQueIter<ItemWithOffset,VSglQueIterBase>* testSglQueIterBaseOffset;
sl@0
  1038
	TestTQueIter<ItemWithOffset,VSglQueIter<ItemWithOffset> >* testSglQueIterOffset;
sl@0
  1039
 
sl@0
  1040
	test.Title();
sl@0
  1041
	test.Start(_L("class TSglQueLink"));
sl@0
  1042
	testSglQueLink=new TestTQueLink<TSglQueLink>;
sl@0
  1043
	testSglQueLink->TestQueLink();
sl@0
  1044
	delete testSglQueLink;
sl@0
  1045
sl@0
  1046
	test.Next(_L("class TSglQueBase"));
sl@0
  1047
	testSglQueBase=new TestTQue<VSglQueBase>;
sl@0
  1048
	testSglQueBase->TestQueBase();
sl@0
  1049
 	delete testSglQueBase;
sl@0
  1050
sl@0
  1051
	test.Next(_L("class TSlgQue"));
sl@0
  1052
	testSglQue=new TestTQue<VSglQue<TSglQueLink> >;
sl@0
  1053
	testSglQue->TestSglQue();
sl@0
  1054
 	delete testSglQue;
sl@0
  1055
sl@0
  1056
	test.Next(_L("class TSglQueIterBase"));
sl@0
  1057
	testSglQueIterBase=new TestTQueIter<Item,VSglQueIterBase>;
sl@0
  1058
	testSglQueIterBase->TestIterBase();
sl@0
  1059
 	delete testSglQueIterBase;
sl@0
  1060
sl@0
  1061
	test.Next(_L("class TSglQueIter"));
sl@0
  1062
	testSglQueIter=new TestTQueIter<Item,VSglQueIter<Item> >;
sl@0
  1063
	testSglQueIter->TestQueIter();
sl@0
  1064
 	delete testSglQueIter;
sl@0
  1065
sl@0
  1066
	test.Next(_L("class TSglQueIterBase with Offset"));
sl@0
  1067
	testSglQueIterBaseOffset=new TestTQueIter<ItemWithOffset,VSglQueIterBase>;
sl@0
  1068
	testSglQueIterBaseOffset->TestIterBase();
sl@0
  1069
 	delete testSglQueIterBaseOffset;
sl@0
  1070
sl@0
  1071
	test.Next(_L("class TSglQueIter with Offset"));
sl@0
  1072
	testSglQueIterOffset=new TestTQueIter<ItemWithOffset,VSglQueIter<ItemWithOffset> >;
sl@0
  1073
	testSglQueIterOffset->TestQueIter();
sl@0
  1074
 	delete testSglQueIterOffset;
sl@0
  1075
sl@0
  1076
	test.Next(_L("Finished"));
sl@0
  1077
	test.End();
sl@0
  1078
	return(KErrNone);
sl@0
  1079
    }
sl@0
  1080
#pragma warning (default: 4710)
sl@0
  1081
sl@0
  1082