Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
htlist_test.cc File Reference

Exhaustive tests for Slinknc, Snodenc, HTList, and DynList classes. More...

#include <gtest/gtest.h>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <memory>
#include <htlist.H>
Include dependency graph for htlist_test.cc:

Go to the source code of this file.

Classes

class  SlinkcTest
 
class  HTListBasicTest
 
class  HTListInsertBugFixTest
 
class  HTListSplitTest
 
class  DynListBasicTest
 
class  DynListRemovePredicateTest
 
class  DynListIteratorTest
 
struct  TestStruct
 

Functions

 TEST_F (SlinkcTest, DefaultConstructor)
 
 TEST_F (SlinkcTest, CopyConstructorResetsLink)
 
 TEST_F (SlinkcTest, AssignmentResetsLink)
 
 TEST_F (SlinkcTest, InsertAndRemove)
 
 TEST_F (SlinkcTest, Reset)
 
 TEST (SnodencTest, DefaultConstructor)
 
 TEST (SnodencTest, CopyConstructor)
 
 TEST (SnodencTest, MoveConstructor)
 
 TEST (SnodencTest, GetDataModification)
 
 TEST (SnodencTest, ChainOfNodes)
 
 TEST (SnodencTest, ToSnodencConversion)
 
 TEST (SnodencTest, ToDataConversion)
 
 TEST_F (HTListBasicTest, DefaultConstructor)
 
 TEST_F (HTListBasicTest, InsertSingleElement)
 
 TEST_F (HTListBasicTest, AppendSingleElement)
 
 TEST_F (HTListBasicTest, InsertMaintainsOrder)
 
 TEST_F (HTListBasicTest, AppendMaintainsOrder)
 
 TEST_F (HTListInsertBugFixTest, InsertListAfterFirstElement)
 
 TEST_F (HTListInsertBugFixTest, InsertListInMiddle)
 
 TEST_F (HTListInsertBugFixTest, InsertListAtEnd)
 
 TEST_F (HTListInsertBugFixTest, InsertEmptyList)
 
 TEST (HTListStack, PushPopSequence)
 
 TEST (HTListStack, EmptyStackThrows)
 
 TEST_F (HTListSplitTest, SplitEmptyList)
 
 TEST_F (HTListSplitTest, SplitUnitaryList)
 
 TEST_F (HTListSplitTest, SplitEvenList)
 
 TEST_F (HTListSplitTest, SplitOddList)
 
 TEST_F (HTListSplitTest, SplitGivesTheNumberOfItemsAndKeepsTheirOrder)
 
 TEST (HTListReverse, ReverseEmptyList)
 
 TEST (HTListReverse, ReverseUnitaryList)
 
 TEST (HTListReverse, ReverseMultipleElements)
 
 TEST (HTListRotation, RotateEmptyListThrows)
 
 TEST (HTListRotation, RotateLeftOne)
 
 TEST_F (DynListBasicTest, DefaultConstructor)
 
 TEST_F (DynListBasicTest, InsertAndRemove)
 
 TEST_F (DynListBasicTest, AppendAndRemove)
 
 TEST_F (DynListBasicTest, PushAndPop)
 
 TEST_F (DynListBasicTest, GetByIndex)
 
 TEST_F (DynListBasicTest, GetByIndexThrowsOnOverflow)
 
 TEST_F (DynListRemovePredicateTest, RemoveExistingElement)
 
 TEST_F (DynListRemovePredicateTest, RemoveFirstElement)
 
 TEST_F (DynListRemovePredicateTest, RemoveLastElement)
 
 TEST_F (DynListRemovePredicateTest, RemoveNonExistentThrows)
 
 TEST_F (DynListRemovePredicateTest, RemoveNeNonExistentReturnsDefault)
 
 TEST_F (DynListRemovePredicateTest, RemoveNeExistingElement)
 
 TEST_F (DynListRemovePredicateTest, RemoveAllMatchingElements)
 
 TEST (DynListSemantics, CopyConstructor)
 
 TEST (DynListSemantics, MoveConstructor)
 
 TEST (DynListSemantics, CopyAssignment)
 
 TEST (DynListSemantics, MoveAssignment)
 
 TEST (DynListSemantics, SelfAssignment)
 
 TEST (DynListConcatenation, AppendByMove)
 
 TEST (DynListConcatenation, AppendByCopy)
 
 TEST (DynListConcatenation, InsertByMove)
 
 TEST (DynListReverse, ReverseMutating)
 
 TEST (DynListReverse, ReverseConst)
 
 TEST_F (DynListIteratorTest, ForwardTraversal)
 
 TEST_F (DynListIteratorTest, IteratorDelete)
 
 TEST_F (DynListIteratorTest, IteratorDeleteMiddle)
 
 TEST_F (DynListIteratorTest, EmptyListIterator)
 
 TEST (DynListComplexTypes, StringList)
 
 TEST (DynListComplexTypes, VectorList)
 
 TEST (DynListComplexTypes, StructList)
 
 TEST (DynListStress, LargeList)
 
 TEST (DynListStress, RandomOperations)
 
 TEST (DynListEdgeCases, EmptyListOperations)
 
 TEST (DynListEdgeCases, UnitaryListOperations)
 
 TEST (DynListEdgeCases, SplitAndMerge)
 
 TEST (HTListRemoveByPointer, HeadMiddleTailAndNotFound)
 
 TEST (HTListIterator, ResetLastEndAndAssignmentCopiesPos)
 
 TEST (HTListSynonyms, PutConcatListSplitListNeReverseListCutList)
 
 TEST (SlinkncIterator, TraversalAndOverflow)
 
 TEST (DynListCount, EveryOperationKeepsTheCount)
 
 TEST (DynListCount, SplitGivesTheFirstHalfToTheLeft)
 
 TEST (DynListCount, RandomSequencesKeepTheCount)
 

Detailed Description

Exhaustive tests for Slinknc, Snodenc, HTList, and DynList classes.

These tests cover all operations including edge cases and the bug fixes made to the classes, particularly:

  • Bug fix in insert(Slinknc*, HTList&) that was losing elements
  • Bug fix in remove_ne(Equal) that had infinite loop potential

Definition in file htlist_test.cc.

Function Documentation

◆ TEST() [1/39]

TEST ( DynListComplexTypes  ,
StringList   
)

◆ TEST() [2/39]

TEST ( DynListComplexTypes  ,
StructList   
)

◆ TEST() [3/39]

TEST ( DynListComplexTypes  ,
VectorList   
)

◆ TEST() [4/39]

TEST ( DynListConcatenation  ,
AppendByCopy   
)

◆ TEST() [5/39]

TEST ( DynListConcatenation  ,
AppendByMove   
)

◆ TEST() [6/39]

TEST ( DynListConcatenation  ,
InsertByMove   
)

◆ TEST() [7/39]

◆ TEST() [8/39]

◆ TEST() [9/39]

◆ TEST() [10/39]

◆ TEST() [11/39]

◆ TEST() [12/39]

◆ TEST() [13/39]

TEST ( DynListReverse  ,
ReverseConst   
)

◆ TEST() [14/39]

TEST ( DynListReverse  ,
ReverseMutating   
)

◆ TEST() [15/39]

TEST ( DynListSemantics  ,
CopyAssignment   
)

◆ TEST() [16/39]

TEST ( DynListSemantics  ,
CopyConstructor   
)

◆ TEST() [17/39]

TEST ( DynListSemantics  ,
MoveAssignment   
)

◆ TEST() [18/39]

TEST ( DynListSemantics  ,
MoveConstructor   
)

◆ TEST() [19/39]

TEST ( DynListSemantics  ,
SelfAssignment   
)

Definition at line 820 of file htlist_test.cc.

References Aleph::DynList< T >::append(), and Aleph::DynList< T >::size().

◆ TEST() [20/39]

◆ TEST() [21/39]

◆ TEST() [22/39]

◆ TEST() [23/39]

◆ TEST() [24/39]

TEST ( HTListReverse  ,
ReverseEmptyList   
)

◆ TEST() [25/39]

TEST ( HTListReverse  ,
ReverseMultipleElements   
)

◆ TEST() [26/39]

◆ TEST() [27/39]

TEST ( HTListRotation  ,
RotateEmptyListThrows   
)

Definition at line 561 of file htlist_test.cc.

References Aleph::HTList::rotate_left().

◆ TEST() [28/39]

◆ TEST() [29/39]

TEST ( HTListStack  ,
EmptyStackThrows   
)

Definition at line 409 of file htlist_test.cc.

References Aleph::HTList::pop(), and Aleph::HTList::top().

◆ TEST() [30/39]

TEST ( HTListStack  ,
PushPopSequence   
)

◆ TEST() [31/39]

◆ TEST() [32/39]

TEST ( SlinkncIterator  ,
TraversalAndOverflow   
)

◆ TEST() [33/39]

TEST ( SnodencTest  ,
ChainOfNodes   
)

Definition at line 155 of file htlist_test.cc.

◆ TEST() [34/39]

TEST ( SnodencTest  ,
CopyConstructor   
)

Definition at line 135 of file htlist_test.cc.

References Aleph::Snodenc< T >::get_data().

◆ TEST() [35/39]

TEST ( SnodencTest  ,
DefaultConstructor   
)

Definition at line 129 of file htlist_test.cc.

References Aleph::Slinknc::is_empty().

◆ TEST() [36/39]

TEST ( SnodencTest  ,
GetDataModification   
)

Definition at line 148 of file htlist_test.cc.

References Aleph::Snodenc< T >::get_data().

◆ TEST() [37/39]

TEST ( SnodencTest  ,
MoveConstructor   
)

Definition at line 141 of file htlist_test.cc.

References Aleph::Snodenc< T >::get_data().

◆ TEST() [38/39]

TEST ( SnodencTest  ,
ToDataConversion   
)

Definition at line 176 of file htlist_test.cc.

References Aleph::Snodenc< T >::get_data(), and Aleph::Slinknc::to_data().

◆ TEST() [39/39]

TEST ( SnodencTest  ,
ToSnodencConversion   
)

◆ TEST_F() [1/36]

TEST_F ( DynListBasicTest  ,
AppendAndRemove   
)

Definition at line 620 of file htlist_test.cc.

◆ TEST_F() [2/36]

TEST_F ( DynListBasicTest  ,
DefaultConstructor   
)

Definition at line 598 of file htlist_test.cc.

◆ TEST_F() [3/36]

TEST_F ( DynListBasicTest  ,
GetByIndex   
)

Definition at line 644 of file htlist_test.cc.

◆ TEST_F() [4/36]

TEST_F ( DynListBasicTest  ,
GetByIndexThrowsOnOverflow   
)

Definition at line 653 of file htlist_test.cc.

◆ TEST_F() [5/36]

TEST_F ( DynListBasicTest  ,
InsertAndRemove   
)

Definition at line 604 of file htlist_test.cc.

◆ TEST_F() [6/36]

TEST_F ( DynListBasicTest  ,
PushAndPop   
)

Definition at line 631 of file htlist_test.cc.

◆ TEST_F() [7/36]

TEST_F ( DynListIteratorTest  ,
EmptyListIterator   
)

◆ TEST_F() [8/36]

TEST_F ( DynListIteratorTest  ,
ForwardTraversal   
)

Definition at line 938 of file htlist_test.cc.

◆ TEST_F() [9/36]

TEST_F ( DynListIteratorTest  ,
IteratorDelete   
)

Definition at line 945 of file htlist_test.cc.

References Aleph::DynList< T >::Iterator::del().

◆ TEST_F() [10/36]

TEST_F ( DynListIteratorTest  ,
IteratorDeleteMiddle   
)

◆ TEST_F() [11/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveAllMatchingElements   
)

Definition at line 739 of file htlist_test.cc.

◆ TEST_F() [12/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveExistingElement   
)

Definition at line 679 of file htlist_test.cc.

◆ TEST_F() [13/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveFirstElement   
)

Definition at line 693 of file htlist_test.cc.

◆ TEST_F() [14/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveLastElement   
)

Definition at line 702 of file htlist_test.cc.

◆ TEST_F() [15/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNeExistingElement   
)

Definition at line 730 of file htlist_test.cc.

◆ TEST_F() [16/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNeNonExistentReturnsDefault   
)

Definition at line 720 of file htlist_test.cc.

◆ TEST_F() [17/36]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNonExistentThrows   
)

Definition at line 711 of file htlist_test.cc.

◆ TEST_F() [18/36]

TEST_F ( HTListBasicTest  ,
AppendMaintainsOrder   
)

Definition at line 246 of file htlist_test.cc.

◆ TEST_F() [19/36]

TEST_F ( HTListBasicTest  ,
AppendSingleElement   
)

Definition at line 219 of file htlist_test.cc.

◆ TEST_F() [20/36]

TEST_F ( HTListBasicTest  ,
DefaultConstructor   
)

Definition at line 197 of file htlist_test.cc.

◆ TEST_F() [21/36]

TEST_F ( HTListBasicTest  ,
InsertMaintainsOrder   
)

Definition at line 232 of file htlist_test.cc.

◆ TEST_F() [22/36]

TEST_F ( HTListBasicTest  ,
InsertSingleElement   
)

Definition at line 206 of file htlist_test.cc.

◆ TEST_F() [23/36]

◆ TEST_F() [24/36]

◆ TEST_F() [25/36]

◆ TEST_F() [26/36]

◆ TEST_F() [27/36]

TEST_F ( HTListSplitTest  ,
SplitEmptyList   
)

Definition at line 431 of file htlist_test.cc.

References Aleph::count(), Aleph::HTList::is_empty(), l, and r.

◆ TEST_F() [28/36]

◆ TEST_F() [29/36]

◆ TEST_F() [30/36]

◆ TEST_F() [31/36]

TEST_F ( HTListSplitTest  ,
SplitUnitaryList   
)

◆ TEST_F() [32/36]

TEST_F ( SlinkcTest  ,
AssignmentResetsLink   
)

Definition at line 83 of file htlist_test.cc.

References Aleph::Slinknc::insert(), and Aleph::Slinknc::is_empty().

◆ TEST_F() [33/36]

TEST_F ( SlinkcTest  ,
CopyConstructorResetsLink   
)

Definition at line 71 of file htlist_test.cc.

References Aleph::copy().

◆ TEST_F() [34/36]

TEST_F ( SlinkcTest  ,
DefaultConstructor   
)

Definition at line 65 of file htlist_test.cc.

◆ TEST_F() [35/36]

TEST_F ( SlinkcTest  ,
InsertAndRemove   
)

◆ TEST_F() [36/36]

TEST_F ( SlinkcTest  ,
Reset   
)

Definition at line 115 of file htlist_test.cc.

References Aleph::Slinknc::insert().