Aleph-w 3.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 (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)
 

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/36]

TEST ( DynListComplexTypes  ,
StringList   
)

◆ TEST() [2/36]

TEST ( DynListComplexTypes  ,
StructList   
)

◆ TEST() [3/36]

TEST ( DynListComplexTypes  ,
VectorList   
)

◆ TEST() [4/36]

TEST ( DynListConcatenation  ,
AppendByCopy   
)

◆ TEST() [5/36]

TEST ( DynListConcatenation  ,
AppendByMove   
)

◆ TEST() [6/36]

◆ TEST() [7/36]

◆ TEST() [8/36]

◆ TEST() [9/36]

◆ TEST() [10/36]

TEST ( DynListReverse  ,
ReverseConst   
)

◆ TEST() [11/36]

TEST ( DynListReverse  ,
ReverseMutating   
)

◆ TEST() [12/36]

TEST ( DynListSemantics  ,
CopyAssignment   
)

◆ TEST() [13/36]

TEST ( DynListSemantics  ,
CopyConstructor   
)

◆ TEST() [14/36]

TEST ( DynListSemantics  ,
MoveAssignment   
)

◆ TEST() [15/36]

TEST ( DynListSemantics  ,
MoveConstructor   
)

◆ TEST() [16/36]

TEST ( DynListSemantics  ,
SelfAssignment   
)

◆ TEST() [17/36]

◆ TEST() [18/36]

◆ TEST() [19/36]

◆ TEST() [20/36]

◆ TEST() [21/36]

TEST ( HTListReverse  ,
ReverseEmptyList   
)

◆ TEST() [22/36]

TEST ( HTListReverse  ,
ReverseMultipleElements   
)

◆ TEST() [23/36]

◆ TEST() [24/36]

TEST ( HTListRotation  ,
RotateEmptyListThrows   
)

Definition at line 535 of file htlist_test.cc.

References Aleph::maps(), and Aleph::HTList::rotate_left().

◆ TEST() [25/36]

◆ TEST() [26/36]

TEST ( HTListStack  ,
EmptyStackThrows   
)

Definition at line 409 of file htlist_test.cc.

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

◆ TEST() [27/36]

TEST ( HTListStack  ,
PushPopSequence   
)

◆ TEST() [28/36]

◆ TEST() [29/36]

TEST ( SlinkncIterator  ,
TraversalAndOverflow   
)

◆ TEST() [30/36]

TEST ( SnodencTest  ,
ChainOfNodes   
)

Definition at line 155 of file htlist_test.cc.

References Aleph::maps().

◆ TEST() [31/36]

TEST ( SnodencTest  ,
CopyConstructor   
)

Definition at line 135 of file htlist_test.cc.

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

◆ TEST() [32/36]

TEST ( SnodencTest  ,
DefaultConstructor   
)

Definition at line 129 of file htlist_test.cc.

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

◆ TEST() [33/36]

TEST ( SnodencTest  ,
GetDataModification   
)

Definition at line 148 of file htlist_test.cc.

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

◆ TEST() [34/36]

TEST ( SnodencTest  ,
MoveConstructor   
)

Definition at line 141 of file htlist_test.cc.

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

◆ TEST() [35/36]

TEST ( SnodencTest  ,
ToDataConversion   
)

◆ TEST() [36/36]

TEST ( SnodencTest  ,
ToSnodencConversion   
)

Definition at line 166 of file htlist_test.cc.

References Aleph::maps(), and Aleph::Slinknc::to_snodenc().

◆ TEST_F() [1/35]

TEST_F ( DynListBasicTest  ,
AppendAndRemove   
)

Definition at line 594 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [2/35]

TEST_F ( DynListBasicTest  ,
DefaultConstructor   
)

Definition at line 572 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [3/35]

TEST_F ( DynListBasicTest  ,
GetByIndex   
)

Definition at line 618 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [4/35]

TEST_F ( DynListBasicTest  ,
GetByIndexThrowsOnOverflow   
)

Definition at line 627 of file htlist_test.cc.

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

◆ TEST_F() [5/35]

TEST_F ( DynListBasicTest  ,
InsertAndRemove   
)

Definition at line 578 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [6/35]

TEST_F ( DynListBasicTest  ,
PushAndPop   
)

Definition at line 605 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [7/35]

TEST_F ( DynListIteratorTest  ,
EmptyListIterator   
)

◆ TEST_F() [8/35]

TEST_F ( DynListIteratorTest  ,
ForwardTraversal   
)

Definition at line 912 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [9/35]

TEST_F ( DynListIteratorTest  ,
IteratorDelete   
)

Definition at line 919 of file htlist_test.cc.

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

◆ TEST_F() [10/35]

TEST_F ( DynListIteratorTest  ,
IteratorDeleteMiddle   
)

◆ TEST_F() [11/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveAllMatchingElements   
)

Definition at line 713 of file htlist_test.cc.

References Aleph::maps(), and Aleph::DynList< T >::remove().

◆ TEST_F() [12/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveExistingElement   
)

Definition at line 653 of file htlist_test.cc.

References Aleph::maps(), and Aleph::DynList< T >::remove().

◆ TEST_F() [13/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveFirstElement   
)

Definition at line 667 of file htlist_test.cc.

References Aleph::maps(), and Aleph::DynList< T >::remove().

◆ TEST_F() [14/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveLastElement   
)

Definition at line 676 of file htlist_test.cc.

References Aleph::maps(), and Aleph::DynList< T >::remove().

◆ TEST_F() [15/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNeExistingElement   
)

Definition at line 704 of file htlist_test.cc.

References Aleph::maps(), and Aleph::DynList< T >::remove_ne().

◆ TEST_F() [16/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNeNonExistentReturnsDefault   
)

Definition at line 694 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [17/35]

TEST_F ( DynListRemovePredicateTest  ,
RemoveNonExistentThrows   
)

Definition at line 685 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [18/35]

TEST_F ( HTListBasicTest  ,
AppendMaintainsOrder   
)

Definition at line 246 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [19/35]

TEST_F ( HTListBasicTest  ,
AppendSingleElement   
)

Definition at line 219 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [20/35]

TEST_F ( HTListBasicTest  ,
DefaultConstructor   
)

Definition at line 197 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [21/35]

TEST_F ( HTListBasicTest  ,
InsertMaintainsOrder   
)

Definition at line 232 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [22/35]

TEST_F ( HTListBasicTest  ,
InsertSingleElement   
)

Definition at line 206 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [23/35]

◆ TEST_F() [24/35]

◆ TEST_F() [25/35]

◆ TEST_F() [26/35]

◆ TEST_F() [27/35]

TEST_F ( HTListSplitTest  ,
SplitEmptyList   
)

◆ TEST_F() [28/35]

◆ TEST_F() [29/35]

◆ TEST_F() [30/35]

◆ TEST_F() [31/35]

TEST_F ( SlinkcTest  ,
AssignmentResetsLink   
)

◆ TEST_F() [32/35]

TEST_F ( SlinkcTest  ,
CopyConstructorResetsLink   
)

Definition at line 71 of file htlist_test.cc.

References Aleph::copy(), Aleph::DynList< T >::get(), and Aleph::maps().

◆ TEST_F() [33/35]

TEST_F ( SlinkcTest  ,
DefaultConstructor   
)

Definition at line 65 of file htlist_test.cc.

References Aleph::maps().

◆ TEST_F() [34/35]

TEST_F ( SlinkcTest  ,
InsertAndRemove   
)

◆ TEST_F() [35/35]

TEST_F ( SlinkcTest  ,
Reset   
)

Definition at line 115 of file htlist_test.cc.

References Aleph::DynList< T >::insert(), and Aleph::maps().