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

Exhaustive tests for Pointer_Table class. More...

#include <gtest/gtest.h>
#include <vector>
#include <set>
#include <random>
#include <algorithm>
#include <stdexcept>
#include <pointer_table.H>
Include dependency graph for pointer_table_test.cc:

Go to the source code of this file.

Classes

class  PointerTableConstructionTest
 
class  PointerTableInsertTest
 
class  PointerTableRemoveTest
 
class  PointerTableRecyclingTest
 
class  PointerTableHeapContractionTest
 
class  PointerTableVerifyTest
 
class  PointerTableGetTest
 
class  PointerTableClearTest
 
class  PointerTableThresholdTest
 
class  PointerTableEdgeCasesTest
 
class  PointerTableStressTest
 
class  PointerTableConsistencyTest
 
class  PointerTableConstTest
 
class  PointerTableMemoryPatternTest
 
class  PointerTableRegressionTest
 

Functions

 TEST_F (PointerTableConstructionTest, DefaultConstructor)
 
 TEST_F (PointerTableConstructionTest, ConstructorWithInitialSize)
 
 TEST_F (PointerTableConstructionTest, ConstructorWithZeroSize)
 
 TEST_F (PointerTableConstructionTest, ConstructorWithLargeSize)
 
 TEST_F (PointerTableInsertTest, InsertSinglePointer)
 
 TEST_F (PointerTableInsertTest, InsertMultiplePointers)
 
 TEST_F (PointerTableInsertTest, InsertSamePointerTwice)
 
 TEST_F (PointerTableInsertTest, InsertManyPointers)
 
 TEST_F (PointerTableRemoveTest, RemoveSinglePointer)
 
 TEST_F (PointerTableRemoveTest, RemoveFromMiddle)
 
 TEST_F (PointerTableRemoveTest, RemoveFromEnd)
 
 TEST_F (PointerTableRemoveTest, RemoveFromBeginning)
 
 TEST_F (PointerTableRemoveTest, RemoveAllPointers)
 
 TEST_F (PointerTableRemoveTest, RemoveInvalidIndexThrows)
 
 TEST_F (PointerTableRemoveTest, RemoveAlreadyFreeIndexThrows)
 
 TEST_F (PointerTableRecyclingTest, RecyclesSingleIndex)
 
 TEST_F (PointerTableRecyclingTest, RecyclesMultipleIndices)
 
 TEST_F (PointerTableRecyclingTest, RecyclesBeforeGrowingHeap)
 
 TEST_F (PointerTableHeapContractionTest, BasicHeapContraction)
 
 TEST_F (PointerTableHeapContractionTest, HeapContractionWithFreeTableCleanup)
 
 TEST_F (PointerTableHeapContractionTest, MultipleContractionLevels)
 
 TEST_F (PointerTableHeapContractionTest, ContractionAfterRemovingConsecutive)
 
 TEST_F (PointerTableVerifyTest, VerifyCorrectPointer)
 
 TEST_F (PointerTableVerifyTest, VerifyIncorrectPointerThrows)
 
 TEST_F (PointerTableVerifyTest, VerifyInvalidIndexThrows)
 
 TEST_F (PointerTableVerifyTest, VerifyAfterRemoveThrows)
 
 TEST_F (PointerTableGetTest, GetValidPointer)
 
 TEST_F (PointerTableGetTest, GetMultiplePointers)
 
 TEST_F (PointerTableGetTest, GetInvalidIndexThrows)
 
 TEST_F (PointerTableGetTest, GetFreedSlotReturnsNull)
 
 TEST_F (PointerTableClearTest, ClearEmptyTable)
 
 TEST_F (PointerTableClearTest, ClearNonEmptyTable)
 
 TEST_F (PointerTableClearTest, ClearPreservesThreshold)
 
 TEST_F (PointerTableClearTest, ClearWithFreeEntries)
 
 TEST_F (PointerTableThresholdTest, DoesNotShrinkBelowThreshold)
 
 TEST_F (PointerTableThresholdTest, ZeroThresholdAllowsFullShrink)
 
 TEST_F (PointerTableEdgeCasesTest, RemoveOnlyElement)
 
 TEST_F (PointerTableEdgeCasesTest, AlternatingInsertRemove)
 
 TEST_F (PointerTableEdgeCasesTest, RemoveInReverseOrder)
 
 TEST_F (PointerTableEdgeCasesTest, RemoveInForwardOrder)
 
 TEST_F (PointerTableStressTest, RandomOperations)
 
 TEST_F (PointerTableStressTest, InterleavedPatterns)
 
 TEST_F (PointerTableStressTest, MassiveGrowthAndShrink)
 
 TEST_F (PointerTableStressTest, HeapContractionStress)
 
 TEST_F (PointerTableConsistencyTest, CountsRemainConsistent)
 
 TEST_F (PointerTableConsistencyTest, HeapIndexNeverExceedsBusiesPlusFrees)
 
 TEST (PointerTableNullIndexTest, NullIndexIsNegative)
 
 TEST_F (PointerTableConstTest, ConstMethodsWork)
 
 TEST_F (PointerTableMemoryPatternTest, SawtoothPattern)
 
 TEST_F (PointerTableMemoryPatternTest, FragmentedPattern)
 
 TEST_F (PointerTableRegressionTest, BugFix_FreeTableNotCleanedOnContraction)
 
 TEST_F (PointerTableRegressionTest, BugFix_CompleteContractionCleansAllFree)
 
int main (int argc, char **argv)
 

Detailed Description

Exhaustive tests for Pointer_Table class.

These tests cover all operations including edge cases and critical scenarios:

  • Basic operations (insert, remove, verify)
  • Index recycling behavior
  • Heap contraction with free_table cleanup (critical bug fix)
  • Exception handling
  • Stress tests with random operations
  • Memory management and threshold behavior

Definition in file pointer_table_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

◆ TEST()

TEST ( PointerTableNullIndexTest  ,
NullIndexIsNegative   
)

◆ TEST_F() [1/51]

◆ TEST_F() [2/51]

◆ TEST_F() [3/51]

◆ TEST_F() [4/51]

◆ TEST_F() [5/51]

TEST_F ( PointerTableConsistencyTest  ,
CountsRemainConsistent   
)

◆ TEST_F() [6/51]

TEST_F ( PointerTableConsistencyTest  ,
HeapIndexNeverExceedsBusiesPlusFrees   
)

◆ TEST_F() [7/51]

◆ TEST_F() [8/51]

◆ TEST_F() [9/51]

◆ TEST_F() [10/51]

◆ TEST_F() [11/51]

◆ TEST_F() [12/51]

TEST_F ( PointerTableEdgeCasesTest  ,
AlternatingInsertRemove   
)

◆ TEST_F() [13/51]

TEST_F ( PointerTableEdgeCasesTest  ,
RemoveInForwardOrder   
)

◆ TEST_F() [14/51]

TEST_F ( PointerTableEdgeCasesTest  ,
RemoveInReverseOrder   
)

◆ TEST_F() [15/51]

TEST_F ( PointerTableEdgeCasesTest  ,
RemoveOnlyElement   
)

◆ TEST_F() [16/51]

TEST_F ( PointerTableGetTest  ,
GetFreedSlotReturnsNull   
)

◆ TEST_F() [17/51]

TEST_F ( PointerTableGetTest  ,
GetInvalidIndexThrows   
)

◆ TEST_F() [18/51]

TEST_F ( PointerTableGetTest  ,
GetMultiplePointers   
)

◆ TEST_F() [19/51]

TEST_F ( PointerTableGetTest  ,
GetValidPointer   
)

◆ TEST_F() [20/51]

TEST_F ( PointerTableHeapContractionTest  ,
BasicHeapContraction   
)

◆ TEST_F() [21/51]

TEST_F ( PointerTableHeapContractionTest  ,
ContractionAfterRemovingConsecutive   
)

◆ TEST_F() [22/51]

TEST_F ( PointerTableHeapContractionTest  ,
HeapContractionWithFreeTableCleanup   
)

◆ TEST_F() [23/51]

TEST_F ( PointerTableHeapContractionTest  ,
MultipleContractionLevels   
)

◆ TEST_F() [24/51]

TEST_F ( PointerTableInsertTest  ,
InsertManyPointers   
)

◆ TEST_F() [25/51]

TEST_F ( PointerTableInsertTest  ,
InsertMultiplePointers   
)

◆ TEST_F() [26/51]

TEST_F ( PointerTableInsertTest  ,
InsertSamePointerTwice   
)

◆ TEST_F() [27/51]

TEST_F ( PointerTableInsertTest  ,
InsertSinglePointer   
)

◆ TEST_F() [28/51]

TEST_F ( PointerTableMemoryPatternTest  ,
FragmentedPattern   
)

◆ TEST_F() [29/51]

TEST_F ( PointerTableMemoryPatternTest  ,
SawtoothPattern   
)

◆ TEST_F() [30/51]

TEST_F ( PointerTableRecyclingTest  ,
RecyclesBeforeGrowingHeap   
)

◆ TEST_F() [31/51]

TEST_F ( PointerTableRecyclingTest  ,
RecyclesMultipleIndices   
)

◆ TEST_F() [32/51]

TEST_F ( PointerTableRecyclingTest  ,
RecyclesSingleIndex   
)

◆ TEST_F() [33/51]

TEST_F ( PointerTableRegressionTest  ,
BugFix_CompleteContractionCleansAllFree   
)

◆ TEST_F() [34/51]

TEST_F ( PointerTableRegressionTest  ,
BugFix_FreeTableNotCleanedOnContraction   
)

◆ TEST_F() [35/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveAllPointers   
)

◆ TEST_F() [36/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveAlreadyFreeIndexThrows   
)

◆ TEST_F() [37/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveFromBeginning   
)

◆ TEST_F() [38/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveFromEnd   
)

◆ TEST_F() [39/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveFromMiddle   
)

◆ TEST_F() [40/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveInvalidIndexThrows   
)

◆ TEST_F() [41/51]

TEST_F ( PointerTableRemoveTest  ,
RemoveSinglePointer   
)

◆ TEST_F() [42/51]

TEST_F ( PointerTableStressTest  ,
HeapContractionStress   
)

◆ TEST_F() [43/51]

TEST_F ( PointerTableStressTest  ,
InterleavedPatterns   
)

◆ TEST_F() [44/51]

TEST_F ( PointerTableStressTest  ,
MassiveGrowthAndShrink   
)

◆ TEST_F() [45/51]

TEST_F ( PointerTableStressTest  ,
RandomOperations   
)

Definition at line 743 of file pointer_table_test.cc.

References Aleph::blossom_maximum_cardinality_matching(), and rng.

◆ TEST_F() [46/51]

◆ TEST_F() [47/51]

◆ TEST_F() [48/51]

TEST_F ( PointerTableVerifyTest  ,
VerifyAfterRemoveThrows   
)

◆ TEST_F() [49/51]

TEST_F ( PointerTableVerifyTest  ,
VerifyCorrectPointer   
)

◆ TEST_F() [50/51]

TEST_F ( PointerTableVerifyTest  ,
VerifyIncorrectPointerThrows   
)

◆ TEST_F() [51/51]

TEST_F ( PointerTableVerifyTest  ,
VerifyInvalidIndexThrows   
)