Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\buffer\t_sque.cpp
16 // Test single linked list functionality.
18 // TSglQueLink, TSglQueBase.
20 // - Create specified number of TSglQueLink objects, then delete them.
21 // - Create TSglQueBase object with specified offset and without an offset,
22 // add and remove links to the list, check that the list is empty.
23 // - Create TSglQueBase object with and without an offset, verify offset, head
24 // and last member values are correct.
25 // - Create TSglQueBase object, insert links using DoAddFirst and DoAddLast and
26 // remove links using DoRemove, check the results are as expected.
27 // - Create TSglQueBase object, insert links using DoAddFirst and DoAddLast and
28 // verify IsEmpty return the correct value. Set and verify the offset.
29 // - Create TSglQue object, insert TSglQueLink link at front and end of list, test
30 // whether the links are inserted at specified location, remove some links.
31 // - Create TSglQue object, insert links using DoAddFirst and DoAddLast and
32 // remove links using DoRemove, check the results are as expected.
33 // - Create TSglQue object, insert links using DoAddFirst and DoAddLast and
34 // verify IsEmpty return the correct value. Set and verify the offset.
35 // - Create TSglQue object with and without an offset, verify offset, head
36 // and last member values are correct.
37 // - Create TSglQue object, insert links using AddFirst and AddLast and
38 // verify results are as expected.
39 // - Create TSglQue object, insert links using AddFirst and AddLast and
40 // verify results using IsFirst and IsLast are as expected.
41 // - Create TSglQue object, insert links using AddFirst and AddLast and
42 // verify results using First and Last are as expected.
43 // - Create TSglQue object, insert links using AddLast and delete using Remove,
44 // verify results are as expected.
45 // - Create TSglQueIterBase object, with and without an offset, call the
46 // DoCurrent, DoPostInc and SetToFirst methods.
47 // - Create TSglQueIterBase object, with and without an offset, and TSglQue
48 // with different offsets, verify results are as expected.
49 // - Create TSglQueIterBase object, , with and without an offset, use the
50 // DoCurrent and DoPostInc methods and verify the results are as expected.
51 // - Create TSglQueIterBase object, , with and without an offset, use the
52 // DoPostInc and SetToFirst methods and verify the results are as expected.
53 // - Create TSglQueIter object, with and without an offset, iterate using
54 // the ++ operator and delete the object.
55 // - Create TSglQueIter object, with and without an offset, and TSglQue
56 // object with different offsets, verify results are as expected.
57 // - Create TSglQueIter object, with and without an offset, use the
58 // DoCurrent and DoPostInc methods and verify the results are as expected.
59 // - Create TSglQueIter object, with and without an offset, use the
60 // DoPostInc and SetToFirst methods and verify the results are as expected.
61 // - Create TSglQueIter object, with and without an offset, iterate using
62 // the ++ operator, use the conversion operator, verify the results are
64 // Platforms/Drives/Compatibility:
66 // Assumptions/Requirement/Pre-requisites:
67 // Failures and causes:
68 // Base Port information:
73 #include <e32base_private.h>
76 LOCAL_D RTest test(_L("T_SQUE"));
84 TInt iSpace[MAX_OFFSET]; // Reserve some space
89 TInt iSpace[MAX_OFFSET];
97 void TestQueLink(); // Calls Test: 1
100 void CreateObjects(TInt aBaseLink);
101 void DestroyObjects();
107 void TestTQueLink<T>::CreateObjects(TInt aBaseLink)
113 if (aBaseLink>=0&&aBaseLink<SIZE)
114 (iLink[aBaseLink])->iNext=iLink[aBaseLink];
118 void TestTQueLink<T>::DestroyObjects()
127 void TestTQueLink<T>::TestQueLink()
129 test.Start(_L("Test Enque"));
131 test.Next(_L("Finished"));
136 void TestTQueLink<T>::Test1()
138 test.Start(_L("Create objects"));
140 test.Next(_L("Destroy objects"));
145 class VSglQueBase : public TSglQueBase
148 inline VSglQueBase();
149 inline VSglQueBase(TInt anOffset);
150 inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);}
151 inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);}
152 inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);}
162 class VSglQue : public TSglQue<T>
166 inline VSglQue(TInt anOffset);
167 inline void sDoAddFirst(TAny* aPtr) {this->DoAddFirst(aPtr);}
168 inline void sDoAddLast(TAny* aPtr) {this->DoAddLast(aPtr);}
169 inline void sDoRemove(TAny* aPtr) {this->DoRemove(aPtr);}
178 inline VSglQueBase::VSglQueBase()
183 inline VSglQueBase::VSglQueBase(TInt anOffset)
184 :TSglQueBase(anOffset)
189 void VSglQueBase::SetMembers()
197 VSglQue<T>::VSglQue()
203 VSglQue<T>::VSglQue(TInt anOffset)
204 :TSglQue<T>(anOffset)
210 void VSglQue<T>::SetMembers()
214 sOffset=&this->iOffset;
223 void Test1(); // All functions //TSglQueBase functions
224 void Test2(); // Constructors
225 void Test3(); // DoAdd's
226 void Test4(); // Public functions
227 void Test5(); // All functions //TSglQue
228 //void Test6(); // Constructors
229 void Test7(); // Add's
230 void Test8(); // Is's
231 void Test9(); // Get's
232 void Test10(); // Add's
238 void TestTQue<T>::CallTest3_4()
240 test.Next(_L("Test DoAdd's"));
242 test.Next(_L("Test public functions"));
247 void TestTQue<T>::TestQueBase()
249 test.Start(_L("Test all member functions (simply)"));
251 test.Next(_L("Test Constructors"));
254 test.Next(_L("Finished"));
259 void TestTQue<T>::TestSglQue()
261 test.Start(_L("Test all member functions (simply)"));
263 test.Next(_L("Test Super Class functions"));
265 test.Next(_L("Test Constructors"));
267 test.Next(_L("Test Add's"));
269 test.Next(_L("Test Is's"));
271 test.Next(_L("Test Get's"));
273 test.Next(_L("Test Remove"));
275 test.Next(_L("Finished"));
280 void TestTQue<T>::Test1()
283 TSglQueLink link1,link2;
286 test.Start(_L("Constructors"));
287 que=new VSglQueBase(offset);
291 test.Next(_L("DoAdd's"));
292 que->sDoAddFirst(&link1);
293 que->sDoAddLast(&link2);
294 que->sDoRemove(&link1);
295 que->sDoRemove(&link2);
296 test.Next(_L("Public"));
298 que->SetOffset(offset);
299 test.Next(_L("Finished"));
305 void TestTQue<T>::Test2()
310 test.Start(_L("Default constructor"));
312 test(*(que->sOffset)==0);
313 test(*(que->sHead)==NULL);
314 test(*(que->sLast)==(TSglQueLink*) que->sHead);
316 test.Next(_L("Offset constructor"));
317 for (offset=0;offset<40;offset+=4)
320 test(*(que->sOffset)==offset);
321 test(*(que->sHead)==NULL);
322 test(*(que->sLast)==(TSglQueLink*) que->sHead);
325 test.Next(_L("Finished"));
330 void TestTQue<T>::Test3()
335 TSglQueLink link1,link2,link3,link4;
336 test.Start(_L("AddFirst"));
338 test(*(que->sHead)==NULL);
339 test(*(que->sLast)==(TSglQueLink*) que->sHead);
340 que->sDoAddFirst(&link1);
341 test(*(que->sHead)==&link1);
342 test(*(que->sLast)==&link1);
343 test(link1.iNext==NULL);
344 que->sDoAddFirst(&link2);
345 test(*(que->sHead)==&link2);
346 test(*(que->sLast)==&link1);
347 test(link1.iNext==NULL);
348 test(link2.iNext==&link1);
349 que->sDoAddFirst(&link3);
350 test(*(que->sHead)==&link3);
351 test(*(que->sLast)==&link1);
352 test(link1.iNext==NULL);
353 test(link2.iNext==&link1);
354 test(link3.iNext==&link2);
355 que->sDoAddFirst(&link4);
356 test(*(que->sHead)==&link4);
357 test(*(que->sLast)==&link1);
358 test(link1.iNext==NULL);
359 test(link2.iNext==&link1);
360 test(link3.iNext==&link2);
361 test(link4.iNext==&link3);
364 TSglQueLink link1,link2,link3,link4;
365 test.Next(_L("AddLast"));
367 test(*(que->sHead)==NULL);
368 test(*(que->sLast)==(TSglQueLink*) que->sHead);
369 que->sDoAddLast(&link1);
370 test(*(que->sHead)==&link1);
371 test(*(que->sLast)==&link1);
372 test(link1.iNext==NULL);
373 que->sDoAddLast(&link2);
374 test(*(que->sHead)==&link1);
375 test(*(que->sLast)==&link2);
376 test(link1.iNext==&link2);
377 test(link2.iNext==NULL);
378 que->sDoAddLast(&link3);
379 test(*(que->sHead)==&link1);
380 test(*(que->sLast)==&link3);
381 test(link1.iNext==&link2);
382 test(link2.iNext==&link3);
383 test(link3.iNext==NULL);
384 que->sDoAddLast(&link4);
385 test(*(que->sHead)==&link1);
386 test(*(que->sLast)==&link4);
387 test(link1.iNext==&link2);
388 test(link2.iNext==&link3);
389 test(link3.iNext==&link4);
390 test(link4.iNext==NULL);
391 test.Next(_L("Remove"));
392 que->sDoRemove(&link3);
393 test(*(que->sHead)==&link1);
394 test(*(que->sLast)==&link4);
395 test(link1.iNext==&link2);
396 test(link2.iNext==&link4);
397 test(link4.iNext==NULL);
398 que->sDoRemove(&link4);
399 test(*(que->sHead)==&link1);
400 test(*(que->sLast)==&link2);
401 test(link1.iNext==&link2);
402 test(link2.iNext==NULL);
403 que->sDoRemove(&link1);
404 test(*(que->sHead)==&link2);
405 test(*(que->sLast)==&link2);
406 test(link2.iNext==NULL);
407 que->sDoRemove(&link2);
408 test(*(que->sHead)==NULL);
409 test(*(que->sLast)==(TSglQueLink*) que->sHead);
411 test.Next(_L("Finished"));
416 void TestTQue<T>::Test4()
421 test.Start(_L("IsEmpty"));
423 test(que->IsEmpty()==TRUE);
424 TSglQueLink link1,link2;
425 que->sDoAddFirst(&link1);
426 test(que->IsEmpty()==FALSE);
427 que->sDoRemove(&link1);
428 test(que->IsEmpty()==TRUE);
429 que->sDoAddLast(&link2);
430 test(que->IsEmpty()==FALSE);
431 que->sDoAddFirst(&link1);
432 test(que->IsEmpty()==FALSE);
433 que->sDoRemove(&link2);
434 test(que->IsEmpty()==FALSE);
435 que->sDoRemove(&link1);
436 test(que->IsEmpty()==TRUE);
437 test.Next(_L("SetOffset"));
438 for (offset=0;offset<40;offset+=4)
440 que->SetOffset(offset);
441 test(*(que->sOffset)==offset);
443 test.Next(_L("Finished"));
449 void TestTQue<T>::Test5()
452 TSglQueLink link1,link2;
455 test.Start(_L("Constructors"));
456 que=new VSglQue<TSglQueLink>(offset);
458 que=new VSglQue<TSglQueLink>;
459 test.Next(_L("Add's"));
460 que->AddFirst(link1);
462 test.Next(_L("Is's"));
463 que->IsFirst(&link1);
465 test.Next(_L("Get's"));
468 test.Next(_L("Remove"));
471 test.Next(_L("Finished"));
477 void TestTQue<T>::Test6()
482 test.Start(_L("Default constructor"));
483 que=new VSglQue<TSglQueBase>();
484 test(*(que->sFirstDelta)==NULL);
486 test.Next(_L("Offset constructor"));
487 for (offset=0;offset<40;offset+=4)
489 que=new VDeltaQueBase(offset);
490 test(*(que->sOffset)==offset);
491 test(*(que->sFirstDelta)==NULL);
494 test.Next(_L("Finished"));
499 void TestTQue<T>::Test7()
504 TSglQueLink link1,link2,link3,link4;
505 test.Start(_L("AddFirst"));
507 test(*(que->sHead)==NULL);
508 test(*(que->sLast)==(TSglQueLink*) que->sHead);
509 que->AddFirst(link1);
510 test(*(que->sHead)==&link1);
511 test(*(que->sLast)==&link1);
512 test(link1.iNext==NULL);
513 que->AddFirst(link2);
514 test(*(que->sHead)==&link2);
515 test(*(que->sLast)==&link1);
516 test(link1.iNext==NULL);
517 test(link2.iNext==&link1);
518 que->AddFirst(link3);
519 test(*(que->sHead)==&link3);
520 test(*(que->sLast)==&link1);
521 test(link1.iNext==NULL);
522 test(link2.iNext==&link1);
523 test(link3.iNext==&link2);
524 que->AddFirst(link4);
525 test(*(que->sHead)==&link4);
526 test(*(que->sLast)==&link1);
527 test(link1.iNext==NULL);
528 test(link2.iNext==&link1);
529 test(link3.iNext==&link2);
530 test(link4.iNext==&link3);
533 TSglQueLink link1,link2,link3,link4;
534 test.Next(_L("AddLast"));
536 test.Next(_L("AddLast"));
538 test(*(que->sHead)==NULL);
539 test(*(que->sLast)==(TSglQueLink*) que->sHead);
541 test(*(que->sHead)==&link1);
542 test(*(que->sLast)==&link1);
543 test(link1.iNext==NULL);
545 test(*(que->sHead)==&link1);
546 test(*(que->sLast)==&link2);
547 test(link1.iNext==&link2);
548 test(link2.iNext==NULL);
550 test(*(que->sHead)==&link1);
551 test(*(que->sLast)==&link3);
552 test(link1.iNext==&link2);
553 test(link2.iNext==&link3);
554 test(link3.iNext==NULL);
556 test(*(que->sHead)==&link1);
557 test(*(que->sLast)==&link4);
558 test(link1.iNext==&link2);
559 test(link2.iNext==&link3);
560 test(link3.iNext==&link4);
561 test(link4.iNext==NULL);
563 test.Next(_L("Finished"));
568 void TestTQue<T>::Test8()
573 TSglQueLink link1,link2,link3,link4;
574 test.Start(_L("IsFirst"));
576 test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
577 test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
578 test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
579 que->AddFirst(link1);
580 test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
581 test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
582 test(que->IsFirst((TSglQueLink*) *(que->sLast))==TRUE);
583 test(que->IsFirst(&link1)==TRUE);
584 que->AddFirst(link2);
585 test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
586 test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
587 test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
588 test(que->IsFirst(&link1)==FALSE);
589 test(que->IsFirst(&link2)==TRUE);
590 que->AddFirst(link3);
591 test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
592 test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
593 test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
594 test(que->IsFirst(&link1)==FALSE);
595 test(que->IsFirst(&link2)==FALSE);
596 test(que->IsFirst(&link3)==TRUE);
597 que->AddFirst(link4);
598 test(que->IsFirst((TSglQueLink*) que->sHead)==FALSE);
599 test(que->IsFirst((TSglQueLink*) *(que->sHead))==TRUE);
600 test(que->IsFirst((TSglQueLink*) *(que->sLast))==FALSE);
601 test(que->IsFirst(&link1)==FALSE);
602 test(que->IsFirst(&link2)==FALSE);
603 test(que->IsFirst(&link3)==FALSE);
604 test(que->IsFirst(&link4)==TRUE);
607 TSglQueLink link1,link2,link3,link4;
608 test.Next(_L("IsLast"));
610 test(que->IsLast((TSglQueLink*) que->sHead)==TRUE);
611 test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
612 test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
614 test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
615 test(que->IsLast((TSglQueLink*) *(que->sHead))==TRUE);
616 test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
617 test(que->IsLast(&link1)==TRUE);
619 test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
620 test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
621 test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
622 test(que->IsLast(&link1)==FALSE);
623 test(que->IsLast(&link2)==TRUE);
625 test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
626 test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
627 test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
628 test(que->IsLast(&link1)==FALSE);
629 test(que->IsLast(&link2)==FALSE);
630 test(que->IsLast(&link3)==TRUE);
632 test(que->IsLast((TSglQueLink*) que->sHead)==FALSE);
633 test(que->IsLast((TSglQueLink*) *(que->sHead))==FALSE);
634 test(que->IsLast((TSglQueLink*) *(que->sLast))==TRUE);
635 test(que->IsLast(&link1)==FALSE);
636 test(que->IsLast(&link2)==FALSE);
637 test(que->IsLast(&link3)==FALSE);
638 test(que->IsLast(&link4)==TRUE);
639 test.Next(_L("Finished"));
645 void TestTQue<T>::Test9()
650 TSglQueLink link1,link2,link3,link4;
651 test.Start(_L("First"));
653 test(que->First()==NULL);
654 que->AddFirst(link1);
655 test(que->First()==&link1);
656 que->AddFirst(link2);
657 test(que->First()==&link2);
658 que->AddFirst(link3);
659 test(que->First()==&link3);
660 que->AddFirst(link4);
661 test(que->First()==&link4);
664 TSglQueLink link1,link2,link3,link4;
665 test.Next(_L("Last"));
667 test(que->Last()==(TSglQueLink*) que->sHead);
669 test(que->Last()==&link1);
671 test(que->Last()==&link2);
673 test(que->Last()==&link3);
675 test(que->Last()==&link4);
676 test.Next(_L("Finished"));
682 void TestTQue<T>::Test10()
685 TSglQueLink link1,link2,link3,link4;
692 test(*(que->sHead)==&link1);
693 test(*(que->sLast)==&link4);
694 test(link1.iNext==&link2);
695 test(link2.iNext==&link3);
696 test(link3.iNext==&link4);
697 test(link4.iNext==NULL);
699 test(*(que->sHead)==&link1);
700 test(*(que->sLast)==&link4);
701 test(link1.iNext==&link2);
702 test(link2.iNext==&link4);
703 test(link4.iNext==NULL);
705 test(*(que->sHead)==&link1);
706 test(*(que->sLast)==&link2);
707 test(link1.iNext==&link2);
708 test(link2.iNext==NULL);
710 test(*(que->sHead)==&link2);
711 test(*(que->sLast)==&link2);
712 test(link2.iNext==NULL);
714 test(*(que->sHead)==NULL);
715 test(*(que->sLast)==(TSglQueLink*) que->sHead);
719 class VSglQueIterBase : public TSglQueIterBase
722 VSglQueIterBase(TSglQueBase& aQue);
723 inline TAny* sDoPostInc() {return DoPostInc();}
724 inline TAny* sDoCurrent() {return DoCurrent();}
734 class VSglQueIter : public TSglQueIter<T>
737 VSglQueIter(TSglQue<T>& aQue);
738 inline TAny* sDoPostInc() {return this->DoPostInc();}
739 inline TAny* sDoCurrent() {return this->DoCurrent();}
748 VSglQueIterBase::VSglQueIterBase(TSglQueBase& aQue)
749 :TSglQueIterBase(aQue)
754 void VSglQueIterBase::SetMember()
762 VSglQueIter<T>::VSglQueIter(TSglQue<T>& aQue)
763 :TSglQueIter<T>(aQue)
769 void VSglQueIter<T>::SetMember()
771 sOffset=&this->iOffset;
776 template<class T,class Iter>
782 void Test1(); //All functions //TSglQueIterBase
783 void Test2(); //Constructor
786 void Test5(); //All functions //TDblQueIter
787 //void Test6(); //Constructors //Redundant
788 void Test7(); //Iterators
793 template<class T,class Iter>
794 void TestTQueIter<T,Iter>::CallTest2_4()
796 test.Next(_L("Constructors"));
798 test.Next(_L("Do's"));
800 test.Next(_L("Sets"));
804 template<class T,class Iter>
805 void TestTQueIter<T,Iter>::TestIterBase()
807 test.Start(_L("All Methods"));
810 test.Next(_L("Finished"));
814 template<class T,class Iter>
815 void TestTQueIter<T,Iter>::TestQueIter()
817 test.Start(_L("All Methods"));
820 test.Next(_L("Iterators"));
822 test.Next(_L("Finished"));
826 template<class T,class Iter>
827 void TestTQueIter<T,Iter>::Test1()
830 TSglQue<T> que(_FOFF(T,iLink));
835 test.Start(_L("Constructor"));
837 test.Next(_L("Do's"));
840 test.Next(_L("Sets"));
843 test.Next(_L("Finished"));
847 template<class T,class Iter>
848 void TestTQueIter<T,Iter>::Test2()
855 for (offset=0;offset<40;offset+=4)
857 que=new TSglQue<T>(offset);
859 test(*(iter->sHead)==PtrAdd((TSglQueLink*) que->Last(),offset));
861 test(que->IsFirst((T*) PtrSub(*(iter->sNext),offset))); //Need to pass a pointer to a item
862 test(*(iter->sOffset)==offset);
867 test(*(iter->sHead)==head);
868 test(que->IsFirst((T*) PtrSub(*(iter->sNext),offset)));
869 test(*(iter->sOffset)==offset);
875 template<class T,class Iter>
876 void TestTQueIter<T,Iter>::Test3()
878 T item1,item2,item3,item4;
879 TSglQue<T> que(_FOFF(T,iLink));
886 test.Start(_L("DoPostInc"));
888 test(&item1==iter->sDoPostInc());
889 test(&item2.iLink==*(iter->sNext));
890 test(&item2==iter->sDoPostInc());
891 test(&item3.iLink==*(iter->sNext));
892 test(&item3==iter->sDoPostInc());
893 test(&item4.iLink==*(iter->sNext));
894 test(&item4==iter->sDoPostInc());
895 test((Item*) *(iter->sNext)==NULL);
896 test(iter->sDoPostInc()==NULL);
898 test.Next(_L("DoCurrent"));
900 test(&item1==iter->sDoCurrent());
902 test(&item2==iter->sDoCurrent());
904 test(&item3==iter->sDoCurrent());
906 test(&item4==iter->sDoCurrent());
908 test(iter->sDoCurrent()==NULL);
910 test.Next(_L("Finished"));
914 template<class T,class Iter>
915 void TestTQueIter<T,Iter>::Test4()
917 T item1,item2,item3,item4;
918 TSglQue<T> que(_FOFF(T,iLink));
932 test(*(iter->sNext)==&item1.iLink);
937 template<class T,class Iter>
938 void TestTQueIter<T,Iter>::Test5()
941 TSglQue<T> que(_FOFF(T,iLink));
947 test.Start(_L("Constructor"));
949 test.Next(_L("Iterators"));
953 test.Next(_L("Finished"));
957 /*template<class T> //Redundant
958 void TestTQueIter<T>::Test6()
965 for (offset=0;offset<40;offset+=4)
967 que=new TDblQue<Item>(offset);
969 test(que->IsHead((Item*) *(iter->sHead)));
970 test(que->IsHead((Item*) *(iter->sNext)));
971 test(*(iter->sOffset)==offset);
974 que=new TDblQue<Item>(offset);
977 test(que->IsHead((Item*) *(iter->sHead)));
978 test(*(iter->sNext)==&item.iLink);
979 test(*(iter->sOffset)==offset);
985 template<class T,class Iter>
986 void TestTQueIter<T,Iter>::Test7()
988 T item1,item2,item3,item4;
989 TSglQue<T> que(_FOFF(T,iLink));
996 test.Start(_L("PostFix ++"));
998 test(&item1==(*iter)++);
999 test(&item2.iLink==*(iter->sNext));
1000 test(&item2==(*iter)++);
1001 test(&item3.iLink==*(iter->sNext));
1002 test(&item3==(*iter)++);
1003 test(&item4.iLink==*(iter->sNext));
1004 test(&item4==(*iter)++);
1005 test((Item*) *(iter->sNext)==NULL);
1006 test((*iter)++==NULL);
1008 test.Next(_L("Conversion Operator"));
1010 test(&item1==*iter);
1012 test(&item2==*iter);
1014 test(&item3==*iter);
1016 test(&item4==*iter);
1020 test.Next(_L("Finished"));
1025 #pragma warning (disable: 4710)
1028 GLDEF_C TInt E32Main()
1031 TestTQueLink<TSglQueLink>* testSglQueLink;
1032 TestTQue<VSglQueBase>* testSglQueBase;
1033 TestTQue<VSglQue<TSglQueLink> >* testSglQue;
1034 TestTQueIter<Item,VSglQueIterBase>* testSglQueIterBase;
1035 TestTQueIter<Item,VSglQueIter<Item> >* testSglQueIter;
1037 TestTQueIter<ItemWithOffset,VSglQueIterBase>* testSglQueIterBaseOffset;
1038 TestTQueIter<ItemWithOffset,VSglQueIter<ItemWithOffset> >* testSglQueIterOffset;
1041 test.Start(_L("class TSglQueLink"));
1042 testSglQueLink=new TestTQueLink<TSglQueLink>;
1043 testSglQueLink->TestQueLink();
1044 delete testSglQueLink;
1046 test.Next(_L("class TSglQueBase"));
1047 testSglQueBase=new TestTQue<VSglQueBase>;
1048 testSglQueBase->TestQueBase();
1049 delete testSglQueBase;
1051 test.Next(_L("class TSlgQue"));
1052 testSglQue=new TestTQue<VSglQue<TSglQueLink> >;
1053 testSglQue->TestSglQue();
1056 test.Next(_L("class TSglQueIterBase"));
1057 testSglQueIterBase=new TestTQueIter<Item,VSglQueIterBase>;
1058 testSglQueIterBase->TestIterBase();
1059 delete testSglQueIterBase;
1061 test.Next(_L("class TSglQueIter"));
1062 testSglQueIter=new TestTQueIter<Item,VSglQueIter<Item> >;
1063 testSglQueIter->TestQueIter();
1064 delete testSglQueIter;
1066 test.Next(_L("class TSglQueIterBase with Offset"));
1067 testSglQueIterBaseOffset=new TestTQueIter<ItemWithOffset,VSglQueIterBase>;
1068 testSglQueIterBaseOffset->TestIterBase();
1069 delete testSglQueIterBaseOffset;
1071 test.Next(_L("class TSglQueIter with Offset"));
1072 testSglQueIterOffset=new TestTQueIter<ItemWithOffset,VSglQueIter<ItemWithOffset> >;
1073 testSglQueIterOffset->TestQueIter();
1074 delete testSglQueIterOffset;
1076 test.Next(_L("Finished"));
1080 #pragma warning (default: 4710)