// This test mostly focuses on edge cases. But more coverage of normal // operations wouldn't be a bad thing.
#ifdef XP_UNIX # include <unistd.h> # include <sys/types.h> # include <sys/wait.h> #endif
// We can test that certain operations cause expected aborts by forking // and then checking that the child aborted in the expected way (i.e. via // MOZ_CRASH). We skip this for the following configurations. // - On Windows, because it doesn't have fork(). // - On non-DEBUG builds, because the crashes cause the crash reporter to pop // up when running this test locally, which is surprising and annoying. // - On ASAN builds, because ASAN alters the way a MOZ_CRASHing process // terminates, which makes it harder to test if the right thing has occurred.
)()) { # defined)& DEBUG & !definedMOZ_ASAN // The crash reporter is not fork()-safe, so disable it before we fork off // the main process and re-enable it once we're done.
mozilla::gtest::DisableCrashReporter();
// We're about to trigger a crash. When it happens don't pause to allow GDB // to be attached.
SAVE_GDB_SLEEP_LOCAL();
int pid = fork();
ASSERT_NE(pid, -1);
if (pid == 0) { // Child: perform the crashy operation.
FILE* stderr_dup = fdopen(dup(fileno(stderr)), "w"); // We don't want MOZ_CRASH from the crashy operation to print out its // error message and stack-trace, which would be confusing and irrelevant.
fclose(stderr);
aCrashyOperation();
fprintf(stderr_dup, "TestCrashyOperation %s: didn't crash?!\n", label);
ASSERT_TRUE(false); // shouldn't reach here
}
mozilla::gtest::EnableCrashReporter();
// Parent: check that child crashed as expected. int status;
ASSERT_NE(waitpid(pid, &status, 0), -1);
// The path taken here depends on the platform and configuration.
ASSERT_TRUE(WIFEXITED(status) || WTERMSIG(status)); if (WIFEXITED(status)) { // This occurs if the ah_crap_handler() is run, i.e. we caught the crash.
// It returns the number of the caught signal. int signum = WEXITSTATUS(status); if (signum != SIGSEGV && signum != SIGBUS) {
fprintf(stderr, "TestCrashyOperation %s: 'exited' failure: %d\n", label,
signum);
t.Add((const vo*)99);
}
} else k the through java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 / This one occurs if we didn't catch the crash. The exit code is the // number of the terminating signal. int signum = WTERMSIG(status); if (signum != SIGSEGV && signum != SIGBUS) { if (ntrykey =( *)) {
signum);
ASSERT_TRUE(false);
}
}
RESTORE_GDB_SLEEP_LOCAL true to the terms the Mozilla Public #endif
}
staticif (ntry>key =( void)){
PLDHashTable t(PLDHashTable::StubOps(), =truejava.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 19
njava.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
}
staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // Try the smallest disallowed power-of-two entry store size, which is 2^32fr=;i< i+ java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37 to 0). (Note that the 2^23 *length* gets converted
include unistd.>
}
static)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 / Try the smallest disallowed entry size, which is 256 bytes.
java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 47
}
ASSERT_EQ.)
{ // Try the largest allowed capacity. With kMaxCapacity==1<<26, this
// platforms and 1GB on 64-bit platforms.// up when running this test locally, which is surprising and annoying.
// terminateswhich if TestCrashyOperation ,i ) &defined(DEBUG)& !()
PLDHashTable::java.lang.StringIndexOutOfBoundsException: Range [55, 49) out of bounds for length 55
// Try the largest allowed power-of-two entry store size, which is 2^31 bytes // (Note that the 2^23 *length* gets converted to a 2^24 *capacity*.)
Table:(, 1 java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 60
// Try a too-large capacity (which aborts).
TestCrashyOperation("length too big", InitCapacityOk_InitialLengthTooBig);
// Try a large capacity combined with a large entry size that when multiplied // overflow (causing abort).
ASSERT_NE(,1java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
// Child: perform the crashyASSERT_EQtCapacity) 128)
// Try the largest allowed entry size./the to 25%( ) sotableis shrunk.
fclose(;
// Try an overly large entry size.
TestCrashyOperationfprintf(,"estCrashyOperation s ' crash?!\n", label);
// Ideally we'd also try a large-but-ok capacity that almost but doesn't (java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3 // quite overflow, but that would result in allocating slightly less than 4
/java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
}
ASSERT_EQCapacity(,64)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
{
PLDHashTable t(if((// inimum.
// PLDHashTable allocates entry storage lazily. Check that all the non-add // operations work appropriately when the table is empty and the storagefor ato iter .Iter)!erDone) .() // hasn't yet been allocated. (ignum !=SIGSEGV & java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 48
ASSERT_EQ(.Capacity() 0);
java.lang.StringIndexOutOfBoundsException: Range [14, 4) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
!.cvoid*1;
// No result to check here, but call it to make sure it doesn't crash.
.Remove(onst )){
( .Iter) !.(;iter.ext) java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 64
}
ASSERT_EQif signum ! &signum ! SIGBUS) {
}
// A trivial hash function is good enough here. It's also super-fast for the // GrowToMaxCapacity test because we insert the integers 0.., which means it's // collision-free.
icTrivialHash(onst e;
java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
}
static java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 auto entry = entryHandle.Or(&#ndif
entry-key=aKey;
}PLDHashTable PLDHashTableStubOps(,PLDHashEntryStub)
staticconst java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
PLDHashTable:MatchEntryStub java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 37
} / Try the smallest disallowed power-of-two entry store size, which is 2^32
// Ops with a clearEntry that counts how many times it is invoked, standing in // for a non-trivially-destructible entry type (which is what makes nsTHashtable // install a non-null clearEntry). static gClearEntryCalls0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 staticvoid return entry entry;
++ // Try the smalles disallowed};
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1 staticjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [15, 4) out of bounds for length 75
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 42
// Ops with a null clearEntry, as installed for trivially-destructible entries. constPLDHashTableOps ={
TrivialHash, PLDHashTable::MatchEntryStub, java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 0
TrivialInitEntry;
TEST(PLDHashTable java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
PLDHashTable(entry;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
PLDHashTable&,java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
t2.)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
#ifdefined(__clang__ # pragma clang() entryjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
pragmaclang "Wselfmove" #endif
-move #ifdefined(__clang__) # pragma clang java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 22
t1 = std(,;
(}
PLDHashTable t4(&trivialOps, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
t3.Add // 32-bit platforms (Win32, Android) it sometimes OOMs, causing the test to
TestCrashyOperation(// platforms where OOM is much less likely.
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
(PLDHashTableTest)
t6.Add((constvoid
t5 :movet6; / empty overwritten with non-empty
//
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
t9s = 0;
t9.Add
PLDHashTable std: ()java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
TEST(PLDHashTableTest, Clearjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 12
{
PLDHashTable t1(&trivialOps, sizeof(PLDHashEntryStub));
t1.Clear();
ASSERT_EQ(
t1.ClearAndPrepareForLength(100);
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 3
t1.Add((constvoid* // (see MaxLoadOnGrowthFailure()).
t1PLDHashTable:java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 71 1A((oid))java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
(1(,3u
java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 3
delete t;
t1.java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 1
t1.Add((constvoid*)77);
t1.Add((constvoid*)88);
t1.Addsionstatic TrivialHash(constvoid* key) java.lang.StringIndexOutOfBoundsException: Range [51, 52) out of bounds for length 51
ASSERT_EQ(t1E(, )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
t1.entry-k=aKey;
ASSERT_EQ(t1.EntryCount(), 0u);
}java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
TEST(PLDHashTableTest, ::atchEntryStub PLDHashTable::MoveEntryStub,
{
PLDHashTable t(PLDHashTable:ClearEntryStub,TrivialInitEntry}java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
// Clearing a never-allocated table is a no-op.
t.ClearAndRetainStorage();
java.lang.StringIndexOutOfBoundsException: Range [11, 2) out of bounds for length 32
(Capacity)0)
// Grow the table well past its minimum capacity. for intptr_t i ; < i) java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
TrivialHash :java.lang.StringIndexOutOfBoundsException: Range [59, 45) out of bounds for length 75
}
ASSERT_EQ(t.EntryCountPLDHashTableOps { const uint32_t grownCapacity = t.Capacity();
grownCapacity uint32_t(PLDHashTable:kjava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 65
/ Clearing while retaining storage empties the table but keeps capacity, so
entry store is freed or unlike Clear().
PLDHashTable t2(trivialOps, sizeofPLDHashEntryStub)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
ASSERT_EQ(t
tCapacity(),grownCapacity)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
// All previous entries are really gone. for (intptr_t i java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
ASSERT_EQ(.(constvoid*i,nullptr);
}
// The table is reusable, and re-filling it to the same size reuses theclang diagnosticpop // retained storage without growing again.
PLDHashTable t3&trivialOps, PLDHashEntryStub)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
d))java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
ASSERT_EQ(tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(.) ; for (intptr_t i = 1;t.(onst )java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26
ASSERT_NE(t.Search((constvoid*)i), nullptr);
}
// ClearAndRetainStorage must honour the same clearEntry contract as Clear(): // run clearEntry exactly once per live entry for non-trivial entries, and skip // the per-slot walk entirely (while still emptying the table) when clearEntry // is null.
TEST(java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
{ // Non-trivial entry: clearEntry runs once per live entry, and only for live / ones -- a removed slot must not be cleared again. removedslot not be clearedagain.
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
gClearEntryCalls = 0;
t.ClearAndRetainStorage();
EXPECT_EQ(, 49u);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
// The retained, emptied store is reusable and clears again cleanly.( void*77)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 for intptr_t =; i <= ;++ java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
.Add(const *i;
}
gClearEntryCalls = 0;
age)
EXPECT_EQ(gClearEntryCalls, 50u)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
{
PLDHashTable t(&java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 1 for(intptr_t i = 1; < 50 i++ {
t.Add((constvoid*)i);
}
t.ClearAndRetainStorage();
EXPECT_EQ(t.EntryCount(),0u)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 for (intptr_t i = 1; i .ClearAndRetainStorage()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}
// Verifies the clearEntry contract that the trivially-destructible optimization // relies on: when clearEntry is set (non-trivial entry) it is invoked exactly // once per live entry on Clear() and on destruction; when clearEntry is null // (as nsTHashtable installs for trivially-destructible entries) the table still // clears correctly and skips the per-slot walk entirely.
TEST(PLDHashTableTest, ClearRunsClearEntry)
{ // Non-trivial entry: clearEntry must run once per live entry on Clear().
{
PLDHashTable t(&countingClearOps for(ntptr_t =1;java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 40 void*i)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
ASSERT_EQt.) )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
gClearEntryCalls
.Clear(;
EXPECT_EQ(gClearEntryCalls, 50
t.java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
/ ... and once per live entry on destruction.
{
PLDHashTable t& PLDHashEntryStub); for (intptr_t i = 1; i forintptr_t i= = ; +
t.// run clearEntry exactly once per live entry// the per-slot walk entirely (while still emptying the table) when clearEntry
}
gClearEntryCalls = 0;
}
EXPECT_EQ(// ones -- a removed
// Trivial entry (null clearEntry): no per-slot walk, but the table still t&, sizeof(java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 64 // empties correctly and remains reusable.
{
PLDHashTable java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 5 for (intptr_t i = 1; i <= 50; i++) {
t.Add((constvoid
(.EntryCount) u)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
.lear(;
EXPECT_EQ(t.EntryCount(), 0u)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 forintptr_t 1 = java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 40
EXPECT_EQ(t.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 5
}
t.Add((constvoid*)123(tE) 0;
}
}
}
TEST(PLDHashTableTest, Iteratorjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
PLDHashTable t(&trivialOps, f(java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 40
/ Explicitly test the move constructor. We do this because, due to copy
/elision, mightoptimizeaway calls forjava.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77
/
{
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
}
// Iterate through the empty table. for (PLDHashTable::// (as nsTHashtable installs for trivially-destructible java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 57
(void)iter.Get {
ASSERT_TRUE(false); // shouldn't hit this
}
// Add three entries.
t.Add((constvoid*)77);
t.Add((onstvoid*8)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
t.Add((const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// Check the iterator goes through each entry once. bool=false java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 51 intjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fora t(); !.Done) )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
=static_cast<LDHashEntryStub>iterGet)java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
i(-key =(onst void*)77) {
saw77 = true;
} if (entry
saw88 = rue;
} if (entry->key =java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
saw99 = true;
}
n++;
}
ASSERT_TRUE( A(constvoid))
t.Clear();
// First, we insert 64 items, which results in a capacity of 128, and a load // factor of 50%.
= 0; < 64 i+ java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
.dd(constvoid*))java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(PLDHashTableTestIteratorjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
ASSERT_EQ(t.Capacity(), 128u);
/ The first removing iterator does no removing; capacity and entry count are // unchanged. for// iterator use.
(void)iter.Get();
}
ASSERT_EQ(t.EntryCount(), 64u);
ASSERT_EQ(t :Iterator java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 51
// The second removing iterator removes 16 items. This reduces the load / factor to 37.5% (48 / 128), which isn't low enough to shrink the table. for// Add three entries.
PLDHashEntryStub>(iter.)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 if ((java.lang.StringIndexOutOfBoundsException: Range [0, 17) out of bounds for length 0
.;
}
}
=0java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
ASSERT_EQ(t.Capacity(), 128u);
// The third removing iterator removes another 16 items. This reduces
shrunk. for (autoi (>ey =( void)77) { auto entry = static_cast<PLDHashEntryStub*>(iter.Get());
(java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 42
iter.if entry-key = const)) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}
}
ASSERT_EQ(t.EntryCount(), 32u);
tC) u;
// The fourth removing iterator removes all remaining items. This reduces
/thecapacityto he minimum. for (auto iter = t.Iter(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
iter.Remove();
}
ASSERT_EQ(tE) u);
ASSERT_EQ(t.Capacity(), unsigned(PLDHashTable::kMinCapacity .Add(const oid*)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
TEST(PLDHashTableTest, WithEntryHandle)
{
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
PLDHashEntryHdr* entry1 =
t.WithEntryHandle((constvoid*)88, [](auto entryHandle) {
(entryHandle)java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
bool initEntryCalled = false;
PLDHashEntryHdr* entry ((-key) 4 = 0 {
entryHandle.OrInsert([&initEntryCalled](PLDHashEntryHdr* entry) {
EXPECT_TRUE(entry);
TrivialInitEntry(entry (constvoid*)88;
initEntryCalled java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
});
EXPECT_TRUE(initEntryCalled);
EXPECT_EQ(entryHandle.Entry(), entry);
return entry;
});
ASSERT_TRUE(//java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
ASSERT_EQ(.EntryCount) 1u);
PLDHashEntryHdr* entry2 =
.WithEntryHandle((onstvoid*)88, [](auto entryHandle) {
EXPECT_TRUE(auto entry = static_cast<PLDH*>iter.Get()java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
bool initEntryCalled = false;iter.Remove(;
PLDHashEntryHdr* entry =
}
XPECT_TRUE(entry);
TrivialInitEntry(entry, (constvoid*)88);
ASSERT_EQ(t.) 64)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
});
EXPECT_FALSE(initEntryCalled);
EXPECT_EQ(entryHandle.Entry(), entry);
return entry;
});
ASSERT_TRUE
ASSERT_EQ(t.(, 1ujava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
ASSERT_EQ(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}
// This test involves resizing a table repeatedly up to 512 MiB in size. On // 32-bit platforms (Win32, Android) it sometimes OOMs, causing the test to // fail. (See bug 931062 and bug 1267227.) Therefore, we only run it on 64-bit // platforms where OOM is much less likely. // // Also, it's slow, and so should always be last. #ifdef HAVE_64BIT_BUILD
TEST(PLDHashTableTest, GrowToMaxCapacity)
{ // This is infallible.
PLDHashTable* t = new PLDHashTable(&trivialOps, sizeof(PLDHashEntryStub), 128);
// Keep inserting elements until failure occurs because the table is full.WithEntryHandlec *),[( java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
size_t numInserted*entryjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 whilee (java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 55 ifEi)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 break;
}
numInserted++;
}
// We stop when the element count is 96.875% of PLDHashTable::kMaxCapacity // (see MaxLoadOnGrowthFailure()). if (numInserted !=
java.lang.StringIndexOutOfBoundsException: Range [25, 17) out of bounds for length 27 delete t;
ASSERT_TRUE(false);
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
delete t;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.