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

Tests for Hash It. More...

#include <gtest/gtest.h>
#include <ahFunctional.H>
#include <ahSort.H>
#include <tpl_dynMapOhash.H>
#include <tpl_dynSetHash.H>
#include <tpl_olhash.H>
#include <tpl_odhash.H>
#include <tpl_lhash.H>
#include <tpl_dynLhash.H>
#include <tpl_hash.H>
#include <algorithm>
#include <deque>
#include <stdexcept>
#include <functional>
#include <map>
#include <ostream>
#include <random>
#include <set>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for hash-it.cc:

Go to the source code of this file.

Classes

struct  OHashTest< HashTbl >
 
struct  EmptyOHashTest< HashTbl >
 

Typedefs

using P = pair< size_t, string >
 
using HashTypes = Types< MapODhash< size_t, string >, MapOLhash< size_t, string >, DynMapLinHash< size_t, string >, DynMapHash< size_t, string > >
 

Functions

 TYPED_TEST_CASE_P (OHashTest)
 
 TYPED_TEST_CASE_P (EmptyOHashTest)
 
 TYPED_TEST_P (EmptyOHashTest, With_exception)
 
 TYPED_TEST_P (OHashTest, Without_exception)
 
 REGISTER_TYPED_TEST_CASE_P (EmptyOHashTest, With_exception)
 
 REGISTER_TYPED_TEST_CASE_P (OHashTest, Without_exception)
 
 INSTANTIATE_TYPED_TEST_CASE_P (Empty, EmptyOHashTest, HashTypes)
 
 INSTANTIATE_TYPED_TEST_CASE_P (NoEmpty, OHashTest, HashTypes)
 
 TEST (OLhashTable, DoubleHashCtorAndOps)
 
 TEST (OLhashTable, KeyToBucketRoundTrip)
 
 TEST (OLhashTable, RemoveThrowsOnMissingKey)
 
 TEST (OLhashTable, InsertRejectsDuplicate)
 
 TEST (OLhashTable, RemovePtrMarksDeleted)
 
 TEST (OLhashTable, NoResizeFillAndSearchMiss)
 
 TEST (OLhashTable, StatsWithDeletedAndBusy)
 
 TEST (OLhashTable, RehashKeepsElements)
 
 TEST (OLhashTable, ConstantHashCollisionsNoResize)
 
 TEST (OLhashTable, RehashAfterDeletesPreservesLiveKeys)
 
 TEST (OLhashTable, SearchOrInsertBehavior)
 
 TEST (OLhashTable, CopyMoveAndSwap)
 
 TEST (OLhashTable, StatsExtremes)
 
 TEST (OLhashTable, CleanTableLeavesEmpty)
 
 TEST (OLhashTable, InsertFailsWhenFullNoResize)
 
 TEST (OLhashTable, ResizeIncreasesCapacity)
 
 TEST (OLhashTable, DeletedSlotIsReused)
 
 TEST (ODhashTable, RemoveMissingInFullTableDoesNotHang)
 
 TEST (ODhashTable, DuplicateInsertAndSearchOrInsert)
 
 TEST (ODhashTable, CopyMoveAssignAndSwap)
 
 TEST (ODhashTable, StatsWithBusyDeletedEmpty)
 
 TEST (ODhashTable, CustomSecondHashSetter)
 
 TEST (ODhashTable, StatsAvgVarFinite)
 
 TEST (ODhashTable, StatsControlledProbes)
 
 TEST (ODhashTable, RehashWithResizeKeepsElements)
 
 TEST (ODhashTable, LinearProbePathCovered)
 
 TEST (ODhashTable, IteratorCollectsAllKeys)
 
 TEST (LhashTable, BusySlotsAfterLastRemoval)
 
 TEST (LhashTable, ShrinksWhenLoadFallsBelowLowerAlpha)
 
 TEST (LhashTable, IteratorDelRemovesAllCollidingBuckets)
 
 TEST (LhashTable, SearchOrInsertReturnsExisting)
 
 TEST (LhashTable, MoveSemanticsPreserveContent)
 
 TEST (LhashTable, InsertRejectsDuplicateAndSearchFinds)
 
 TEST (LhashTable, SearchNextReturnsNullWhenNoDuplicateKey)
 
 TEST (LhashTable, IteratorBoundsThrow)
 
 TEST (LhashTable, EmptyResetsCountersAndBuckets)
 
 TEST (LhashTable, RemoveAllBucketsFalseKeepsOwnership)
 
 TEST (LhashTable, SwapExchangesState)
 
 TEST (LhashTable, SetHashFunctionChangesDistribution)
 
 TEST (LhashTable, NoResizeModeKeepsCapacity)
 
 TEST (LhashTable, SetWithResizeTurnsResizingOnAndOff)
 
 TEST (DynSetLhash, CopyKeepsWhetherTheTableResizes)
 
 TEST (LhashTable, CustomComparatorActsAsEquality)
 
 TEST (LhashTable, CurrentAlphaNonZero)
 
 TEST (LhashTable, TheTableThatWasMovedFromTakesBucketsAgain)
 
 TEST (LhashTable, TheTableThatWasMovedFromKeepsItsHashFunction)
 
 TEST (LhashTable, AMoveAssignmentSwapsWhatRulesTheTables)
 
 TEST (LhashTable, AMoveAssignmentOfATableThatDoesNotOwnItsBucketsLeavesTheOtherEmpty)
 
 TEST (LhashTable, AComparatorThatCannotBeMovedIsSwappedThroughItsCopies)
 
 TEST (DynLhashTable, AComparatorThatCannotBeMovedIsSwappedThroughItsCopies)
 
 TEST (DynSetLhash, AComparatorThatCannotBeMovedIsSwappedThroughItsCopies)
 
 TEST (HashTables, TheyAreMovedWithAComparatorThatCannotBeMoved)
 

Variables

constexpr size_t N = 1000
 

Detailed Description

Tests for Hash It.

Definition in file hash-it.cc.

Typedef Documentation

◆ HashTypes

using HashTypes = Types<MapODhash<size_t, string>, MapOLhash<size_t, string>, DynMapLinHash<size_t, string>, DynMapHash<size_t, string> >

Definition at line 134 of file hash-it.cc.

◆ P

using P = pair<size_t, string>

Definition at line 64 of file hash-it.cc.

Function Documentation

◆ INSTANTIATE_TYPED_TEST_CASE_P() [1/2]

INSTANTIATE_TYPED_TEST_CASE_P ( Empty  ,
EmptyOHashTest  ,
HashTypes   
)

◆ INSTANTIATE_TYPED_TEST_CASE_P() [2/2]

INSTANTIATE_TYPED_TEST_CASE_P ( NoEmpty  ,
OHashTest  ,
HashTypes   
)

◆ REGISTER_TYPED_TEST_CASE_P() [1/2]

REGISTER_TYPED_TEST_CASE_P ( EmptyOHashTest  ,
With_exception   
)

◆ REGISTER_TYPED_TEST_CASE_P() [2/2]

REGISTER_TYPED_TEST_CASE_P ( OHashTest  ,
Without_exception   
)

◆ TEST() [1/52]

◆ TEST() [2/52]

TEST ( DynSetLhash  ,
AComparatorThatCannotBeMovedIsSwappedThroughItsCopies   
)

◆ TEST() [3/52]

TEST ( DynSetLhash  ,
CopyKeepsWhetherTheTableResizes   
)

◆ TEST() [4/52]

◆ TEST() [5/52]

TEST ( LhashTable  ,
AComparatorThatCannotBeMovedIsSwappedThroughItsCopies   
)

Definition at line 3708 of file hash-it.cc.

◆ TEST() [6/52]

◆ TEST() [7/52]

◆ TEST() [8/52]

TEST ( LhashTable  ,
BusySlotsAfterLastRemoval   
)

Definition at line 586 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [9/52]

TEST ( LhashTable  ,
CurrentAlphaNonZero   
)

Definition at line 935 of file hash-it.cc.

References tbl.

◆ TEST() [10/52]

TEST ( LhashTable  ,
CustomComparatorActsAsEquality   
)

Definition at line 913 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [11/52]

TEST ( LhashTable  ,
EmptyResetsCountersAndBuckets   
)

◆ TEST() [12/52]

TEST ( LhashTable  ,
InsertRejectsDuplicateAndSearchFinds   
)

Definition at line 689 of file hash-it.cc.

References tbl.

◆ TEST() [13/52]

TEST ( LhashTable  ,
IteratorBoundsThrow   
)

Definition at line 731 of file hash-it.cc.

References Aleph::Dlink::insert(), and tbl.

◆ TEST() [14/52]

TEST ( LhashTable  ,
IteratorDelRemovesAllCollidingBuckets   
)

◆ TEST() [15/52]

◆ TEST() [16/52]

TEST ( LhashTable  ,
NoResizeModeKeepsCapacity   
)

◆ TEST() [17/52]

TEST ( LhashTable  ,
RemoveAllBucketsFalseKeepsOwnership   
)

Definition at line 772 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [18/52]

TEST ( LhashTable  ,
SearchNextReturnsNullWhenNoDuplicateKey   
)

Definition at line 708 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [19/52]

TEST ( LhashTable  ,
SearchOrInsertReturnsExisting   
)

Definition at line 654 of file hash-it.cc.

References tbl.

◆ TEST() [20/52]

TEST ( LhashTable  ,
SetHashFunctionChangesDistribution   
)

Definition at line 820 of file hash-it.cc.

References k, and tbl.

◆ TEST() [21/52]

TEST ( LhashTable  ,
SetWithResizeTurnsResizingOnAndOff   
)

Definition at line 858 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, k, and tbl.

◆ TEST() [22/52]

TEST ( LhashTable  ,
ShrinksWhenLoadFallsBelowLowerAlpha   
)

Definition at line 608 of file hash-it.cc.

References tbl.

◆ TEST() [23/52]

◆ TEST() [24/52]

TEST ( LhashTable  ,
TheTableThatWasMovedFromKeepsItsHashFunction   
)

◆ TEST() [25/52]

◆ TEST() [26/52]

◆ TEST() [27/52]

TEST ( ODhashTable  ,
CustomSecondHashSetter   
)

Definition at line 507 of file hash-it.cc.

References k, Aleph::ODhashTable< Key, Cmp >::set_second_hash_fct(), and tbl.

◆ TEST() [28/52]

TEST ( ODhashTable  ,
DuplicateInsertAndSearchOrInsert   
)

Definition at line 449 of file hash-it.cc.

References tbl.

◆ TEST() [29/52]

TEST ( ODhashTable  ,
IteratorCollectsAllKeys   
)

Definition at line 566 of file hash-it.cc.

References tbl.

◆ TEST() [30/52]

TEST ( ODhashTable  ,
LinearProbePathCovered   
)

Definition at line 557 of file hash-it.cc.

References tbl.

◆ TEST() [31/52]

TEST ( ODhashTable  ,
RehashWithResizeKeepsElements   
)

Definition at line 540 of file hash-it.cc.

References tbl.

◆ TEST() [32/52]

TEST ( ODhashTable  ,
RemoveMissingInFullTableDoesNotHang   
)

Definition at line 431 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [33/52]

TEST ( ODhashTable  ,
StatsAvgVarFinite   
)

Definition at line 516 of file hash-it.cc.

References OhashCommon< HashTbl, Key >::insert(), and tbl.

◆ TEST() [34/52]

TEST ( ODhashTable  ,
StatsControlledProbes   
)

Definition at line 525 of file hash-it.cc.

References tbl.

◆ TEST() [35/52]

TEST ( ODhashTable  ,
StatsWithBusyDeletedEmpty   
)

Definition at line 493 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [36/52]

TEST ( OLhashTable  ,
CleanTableLeavesEmpty   
)

Definition at line 377 of file hash-it.cc.

References tbl.

◆ TEST() [37/52]

TEST ( OLhashTable  ,
ConstantHashCollisionsNoResize   
)

Definition at line 259 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [38/52]

◆ TEST() [39/52]

TEST ( OLhashTable  ,
DeletedSlotIsReused   
)

Definition at line 417 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [40/52]

TEST ( OLhashTable  ,
DoubleHashCtorAndOps   
)

Definition at line 146 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [41/52]

TEST ( OLhashTable  ,
InsertFailsWhenFullNoResize   
)

Definition at line 387 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [42/52]

TEST ( OLhashTable  ,
InsertRejectsDuplicate   
)

Definition at line 186 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [43/52]

TEST ( OLhashTable  ,
KeyToBucketRoundTrip   
)

Definition at line 166 of file hash-it.cc.

References OhashCommon< HashTbl, Key >::insert(), and tbl.

◆ TEST() [44/52]

TEST ( OLhashTable  ,
NoResizeFillAndSearchMiss   
)

Definition at line 209 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [45/52]

TEST ( OLhashTable  ,
RehashAfterDeletesPreservesLiveKeys   
)

Definition at line 276 of file hash-it.cc.

References tbl.

◆ TEST() [46/52]

TEST ( OLhashTable  ,
RehashKeepsElements   
)

Definition at line 243 of file hash-it.cc.

References tbl.

◆ TEST() [47/52]

TEST ( OLhashTable  ,
RemovePtrMarksDeleted   
)

Definition at line 197 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TEST() [48/52]

TEST ( OLhashTable  ,
RemoveThrowsOnMissingKey   
)

Definition at line 179 of file hash-it.cc.

References OhashCommon< HashTbl, Key >::insert(), and tbl.

◆ TEST() [49/52]

TEST ( OLhashTable  ,
ResizeIncreasesCapacity   
)

Definition at line 400 of file hash-it.cc.

References tbl.

◆ TEST() [50/52]

TEST ( OLhashTable  ,
SearchOrInsertBehavior   
)

Definition at line 300 of file hash-it.cc.

References tbl.

◆ TEST() [51/52]

◆ TEST() [52/52]

TEST ( OLhashTable  ,
StatsWithDeletedAndBusy   
)

Definition at line 220 of file hash-it.cc.

References Aleph::hash_default_lower_alpha, Aleph::hash_default_upper_alpha, and tbl.

◆ TYPED_TEST_CASE_P() [1/2]

TYPED_TEST_CASE_P ( EmptyOHashTest  )

◆ TYPED_TEST_CASE_P() [2/2]

TYPED_TEST_CASE_P ( OHashTest  )

◆ TYPED_TEST_P() [1/2]

TYPED_TEST_P ( EmptyOHashTest  ,
With_exception   
)

Definition at line 93 of file hash-it.cc.

References tbl.

◆ TYPED_TEST_P() [2/2]

TYPED_TEST_P ( OHashTest  ,
Without_exception   
)

Variable Documentation

◆ N

constexpr size_t N = 1000
constexpr

Definition at line 66 of file hash-it.cc.