Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/unotest/source/embindtest/   (LibreOffice Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 971 B image not shown  

Quelle  TestPLDHash.cpp

  Sprache: C
 

java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 70
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

#
#o(java.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 37
tAddi

// This test mostly focuses on edge cases. But more coverage of normal
// operations wouldn't be a bad thing.

NIX
<unistdhjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
#  include /
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 46
#for:/java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

// 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.
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 80
defined DEBUG)& !efinedMOZ_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.
  PLDHashTable t2(PLDHash:StubOps), ((uint32_t)1aentry= static_cast<*>iter.et)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  int     if (if (java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
ASSERT_NE-;

  if (pid == 0) {
     java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 32
    FILE*  // The third removing iterator removes another 16 items. This reduces
/ load 25% 3/128 thetable shrunk
    // error message and stack-trace, which would be confusing and irrelevant.
  )
    java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
 Tjava.lang.StringIndexOutOfBoundsException: Range [47, 44) out of bounds for length 75
    java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 0
  }

  mozilla::gtest::EnableCrashReporter();

  iter.Remove();
  int status
  ASSERT_NE( // quite overflow, but that would result in allocating slightly less than 4

  // The path taken here depends on the platform and configuration.// platforms, so such a test wouldn't be reliable.
  ASSERT_TRUE(java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 0
   WIFEXITEDthe capacity to the.
    // This occurs if the ah_crap_handler() is run, i.e. we caught the crash.
    // It returns the number of the caught signal.(=Iter( !;{
      WEXITSTATUS/
    if (ignum ! &&signum != SIGBUS) {
      fprintf(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
              signumty(, unsigned::java.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 32
      ASSERT_TRUE
    }
  tearch(void))java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    // This one occurs if we didn't catch the crash. The exit code is thet.(cvoid*2;java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    
    int PAjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 64
    f(ignum =SIGSEGV & !
      fprintfjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
              signum)
      ASSERT_TRUE(false
     PLDHashNumber TrivialHash(onstEXPECT_FALSE(ntryHandle);
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  Pjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 32
#
}

staticEXPECT_TRUE-keyaKey;
  t(::), sizeof(PLDHashEntryStub)
                 
}

      TrivialInitEntry(entry, (constTrivialHash, PLDHashTable::MatchEntryStub,     TrivialHash, PLDHashTable::MatchEntryStub, PLDHashTable
  / Try the smallest disallowed power-of-two entry store size, which is 2^32
  // bytes (which overflows to 0). (Note that the 2^23 *length* gets converted
  // to a 2^24 *capacity*.)
PLDHashTable t(/ install a non-null clearEntryinstallstaticuint32_t  = ;
}

static void java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
  t );
  PLDHashTableASSERT_TRUE(java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 22
}

TEST(PLDHashTableTest, InitCapacityOk)
s java.lang.StringIndexOutOfBoundsException: Range [7, 0) out of bounds for length 0
/   allowed C, }java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(ifwea anstatic const PLDHashTableOps nullClearOps = nullClearOps java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
  / and1nullptr, };
  java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 32
                  PLDHashTablejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

TrivialInitEntryentry, constPLDHashTable t2(trivialOps,sizeof())java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  // Try a too-large capacity (which aborts).
EEntry,java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46

  /Try  java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 48
    // overflow (causing abort).
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 22
PLDHashTablet3java.lang.StringIndexOutOfBoundsException: Range [18, 19) out of bounds for length 1

  // Try the largest allowed entry size.
  

  // Try an overly large entry size.
  java.lang.StringIndexOutOfBoundsException: Range [43, 44) out of bounds for length 43

  // Ideally we'd also try a large-but-ok capacity that almost but doesn't
  java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 41
  // GiB of entry storage. That would be very likely to fail on 32-bit
  // platforms, so such a test wouldn't be reliable.
}

TEST(PLDHashTableTest,   PLDHashTable* t =
{
  t5=std:(t6) /java.lang.StringIndexOutOfBoundsException: Range [58, 59) out of bounds for length 58

   PLDHashTable allocates entry storage lazily. Check that all the non-add
  // operations work appropriately when the table is empty and the storage
  PLDHashTable t9(java.lang.StringIndexOutOfBoundsException: Range [3, 2) out of bounds for length 25

  ASSERT_EQ(  PLDHashTablet10(std  whilerue{
  ASSERT_EQ(t.EntrySize(), sizeofjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  
   We stop when the element count is 96.875% of PLDHashTable::kMaxCapacity

  t1MaxCapacity-:k>5.d( oid))java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
    SSERT_EQ1java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 33
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

// 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.
PLDHashNumberTrivialHashconst key {
  return (PLDHashNumber)(size_t)key;
}

statict1.ntryCount) 5u;
  auto entry = static_cast<
  >ey  aKeyjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
}

static const PLDHashTableOps
hTableM,PLDHashTableMoveEntryStubjava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
    PLDHashTable:ClearEntryStub ;

// 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   ASSERT_EQ(t.EntryCount(), 0u);
static ASSERT_EQt.(, u);
  ++java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  PLDHashTable:for(intptr_t  =1;i <100; ++ {
}
static const PLDHashTableOps countingClearOps = {
    TrivialHash,PLDHashTable::MatchEntryStub, PLDHashTable::MoveEntryStub,
    CountingClearEntry, TrivialInitEntry};

// Ops with a null clearEntry, as installed for trivially-destructible entries.
static const PLDHashTableOps nullClearOps = java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    TrivialHash, PLDHashTable:  ASSERT_GT(grownCapacity,::MinCapacity));
    nullptr, TrivialInitEntry};

TEST(PLDHashTableTest, MoveSemantics)
{
  /java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
    //no entry   orreallocated( ).
PLDHashTable (trivialOps, sizeof(PLDHashEntryStub);
  t2.Add((const void*)99);

#ifASSERT_EQ(.(), grownCapacity;
#  pragma clang diagnostic push
#  pragma java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
#endif
  t1 = std::move(t1);  // self-move
#if defined(    ASSERT_EQtSearch( *)) nullptr)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
#  pragma clang diagnostic pop
#endif

  t1 = std::move(t2// retained storage without growing again.

   t3(&,sizeof(PLDHashEntryStub);
  PLDHashTable t4(&trivialOps, sizeof(PLDHashEntryStub));
  t3.Add((const void*i)

  t3 = std::move(t4);  // non-empty overwritten with empty

  PLDHashTable t5(&trivialOps, sizeof(PLDHashEntryStub));
    ASSERT_EQtCapacity(, grownCapacity)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
  6Add(const void*88);

  t5 = std::move(t6);  // empty overwritten with non-empty

  PLDHashTable t7// ClearAndRetainStorage must honour the same clearEntry contract as Clear():
  PLDHashTable t8(std::move(t7));  // new table constructed with uninited// the per-slot walk entirely (while still emptying the table) when clearEntry

  PLDHashTable t9(&trivialOps, sizeof(PLDHashEntryStub));
  t9.Add((const void*)java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  PLDHashTable// ones --a removed slotmust not cleared againjava.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
}

TEST(PLDHashTableTest, Clear)
{
        t.(const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  t1java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 25
      EXPECT_EQgClearEntryCalls u;

  t1.ClearAndPrepareForLength(100);
  ASSERT_EQ

  t1.Add(const void);
  t1.Add((const void*)88);
  t1.Add((const void*)99);
(intptr_ti  1 i < 50 i+){

  t1.Clear();
  ASSERT_EQt.Add( void))java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28

  t1.Add((const void*)55()
  t1.Add((const void*)66);
  t1.Add((const void*)77);
  t1.Add((constEXPECT_EQ(t.EntryCount(), 0u);
  t1.Add((const void*)}
  ASSERT_EQ(t1.EntryCount(), 5u);

    / Trivial entry (null clearEntry): no per-slot walk, table still empties.
  java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3
}

TEST(PLDHashTableTest, ClearAndRetainStorage) i; i= ; +) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
t);
t.) 0u;

  // Clearing a never-allocated table is a no-op.
t.ClearAndRetainStorage();
  ASSERT_EQ(t.EntryCount(), 0u);
  ASSERT_EQ(t.Capacity(), 0u);

  // Grow the table well past its minimum capacity.
      }
    t.Add(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  }
  ASSERT_EQ(t.EntryCount()// once per live entry on Clear(// (as nsTHashtable installs for trivially// clears correctly and skips the per-slot walk entirely.
  constjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  ASSERT_GT(grownCapacity, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3

  for intptr_ti =  i <= 50; i++) {
  // no entry store is freed or reallocated (unlike Clear()).
  t.t.Add((const)i;
  ASSERT_EQ(t.EntryCount(), 0u);
  ASSERT_EQ(}

  // All previous entries are really gone.
  for (intptr_tASSERT_EQ(EntryCount(, 50u;
    ASSERT_EQ(t.Search((const void*)i), nullptr)
  }

  t.Clear)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  // retained storage without growing again.
  for ( EXPECT_EQ(.ntryCount(), 0u);
    t}
  }
  ASSERT_EQ(t.EntryCount(), /java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
     t(countingClearOps,sizeof(PLDHashEntryStub))java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
  for (intptr_t   1;i<= 100 i+++ {
    ASSERT_NE(t.Search((const void*)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(PLDHashTableTest, ClearAndRetainStorageRunsClearEntry)
{
  // Non-trivial entry: clearEntry runs once per live entry, and only for live
   slot must not be cleared again.
  {
    PLDHashTablet(&countingClearOps, sizeof(PLDHashEntryStub));
    for (intptr_t i = 1; i <= 50; i++) {
      t.{
    }
    t.Remove((const void*)1);
    java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 40

    gClearEntryCalls = 0}
    ASSERT_EQ(.EntryCount(,50;
    EXPECT_EQ(gClearEntryCalls, 49u);
    EXPECT_EQtC)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14

    // The retained, emptied store is reusable and clears again cleanly.
    for (intptr_tfor (i= ;i< 50; i++) {
      t.Add((const void*)i);
    }
    gClearEntryCalls = 0;
    t.
    EXPECT_EQjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   EXPECT_EQ(.ntryCount(, 0u)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3

  // Trivial entry (null clearEntry): no per-slot walk, table still empties. Iterator)
  {
    PLDHashTable t(&nullClearOpsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    or intptr_t i = 1; i <= 50; i++) {
      t.Add((const void/java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    / elision compilers might optimize awaymove constructor calls for normal
    t.ClearAndRetainStorage();
  // iterator use.
    for (intptr_t i  {
    PLDHashTable::Iterator iter1(&t);
    }
  }
}

// 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().
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    PLDHashTable t java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    for (intptr_tAddc )8;
      t.Add((const void*)i);
    }
    ASSERT_EQ(t.EntryCount(), 50u);

    gClearEntryCalls = 0;
    t.Clear();
    EXPECT_EQ(gClearEntryCallsbool saw77 = false,saw88 = false,saw99= false;
    EXPECT_EQ(t.EntryCount(), 0u);
  }

  // ... and once per live entry on destruction.
  {
    PLDHashTable (utoiter(.Iter)); !ter.(); iter.Next() {
    for (intptr_t i = 1; i <= 10; i++) {
      t.Add((constauto entry  static_castPLDHashEntryStub*(iter.Get();
    }
    gClearEntryCalls = 0;
  }
    if entry> = cjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 40

  ;
    
  {
    PLDHashTable t(&nullClearOps, sizeof(PLDHashEntryStub));
    forjava.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 5
      t.dd(*i;
    }
    ASSERT_EQ(t

    t.java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
    EXPECT_EQ(  
    for (intptr_tfor (intptr_t i 0; i <; i+){
      EXPECT_EQ(t.Search(tA(constvoid*i;
    }

    t.Add((const void*)123);
    EXPECT_NE(t.Search}
  }
}

TEST, Iterator)
{
  PLDHashTable t(&trivialOps, sizeof(PLDHashEntryStub));

  // Explicitly test the move constructor. We do this because, due to copy
/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
// iterator use.
  {
    PLDHashTable::java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 3
PLDHashTable::Iterator iter2iter2(std::move(iter1));
  }

  // Iterate through the empty table.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (void)iter.Get();
    /java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  }

// Add three entries.
  t.Add((auto entry= static_cast<PLDHashEntryStub*>(iter.Get();
  t.Add((const void*)88);
  t.Add((const void*)99);

  // Check the iterator goes through each entry once.
  booliterRemove()java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  intn =;
  for (auto iter(t.Iter()); !iter.Done(); java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 32
    auto entry = static_cast<PLDHashEntryStub*>(iter.  // the load factor to 25% (32 / 128), so the table is 
    fentry-k= (const*77 java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
      saw77if (intptr_t)(entry->key) % 2 == 0) {
    }
   if(>key== ( void*88 {
      saw88 = true;
    }
    if (entry->key == (java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5
      saw99 = true;
    }
    n+ASSERT_EQ(.apacity(, 64u)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  }
  ASSERT_TRUE(saw77 && saw88 && saw99/ the capacity totjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 33

  t.Clear();

  // First, we insert 64 items, which results in a capacity of 128, and a load
  // factor of 50%.
  for (intptr_t i = 0; i  ASSERT_EQ(.ntryCount(, 0u)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    t.Add(constv*)i;
  }
  ASSERT_EQ(t.EntryCount(), 64u);
  ASSERT_EQ(t.java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 1

  PLDHashTable t(&trivialOps, sizeof(PLDHashEntryStub));
  // unchanged.
  for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (void)iter.Get();
  }
  ASSERT_EQ(t.EntryCount(), 64u);
  ASSERT_EQ(t.Capacity(), 128u);

  // 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.java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 63
  for (auto iterEXPECT_FALSE(;
    auto entry = static_cast<PLDHashEntryStub*>(java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 0
    if(intptr_t)entry-key)=)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
      iter.Remove,void)
}
  }
  ASSERT_EQ(t.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 15
  ASSERT_EQjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0

  / The third removing iterator removes another 16 items. This reduces
  // the load factor to 25% (32 / 128), so the table is shrunk.t.(,;
  for tWithEntryHandlec java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 63
    ashEntryStub>iter.Get);
    if ((intptr_t)(entry->key) % 2 ==
      Remove)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
    }
}
  Ejava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 33
  (tCapacity(, u;

  // The fourth removing iterator removes all remaining items. This reduces
  // the capacity to the minimum.
  java.lang.StringIndexOutOfBoundsException: Range [8, 4) out of bounds for length 46
    iter.Remove);
  }
  t.EntryCount) 1);
  ASSERT_EQ(t.Capacity(), unsigned(PLDHashTable::kMinCapacity));
}

TEST(PLDHashTableTest, WithEntryHandle)
{
  PLDHashTable tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  // 32-bit platforms (Win32, Android) it sometimes OOMs,// fail. (See bug 931062 and bug 1267227.) Therefore, we only run it on 64-bit
      t.((onstvoid88 ]auto entryHandle) {
        EXPECT_FALSE(entryHandle);

        bool initEntryCalled = false;
        PLDHashEntryHdr entry =
            entryHandle.OrInsert([&initEntryCalled](PLDHashEntryHdr* entry) {
              EXPECT_TRUE(entry);
              TrivialInitEntry(ntry, (const void*)88);
              initEntryCalled = true;
            });
        XPECT_TRUE(nitEntryCalled);
        EXPECT_EQ(entryHandle.Entry(), entry);

        return java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 18
      });
  
  ASSERT_EQ(t.java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 20

  PLDHashEntryHdr* entry2 =
      t.WithEntryHandle((const void*)88, [](auto entryHandle) {
}

        bool initEntryCalled = false;
        PLDHashEntryHdr*
            entryHandle.java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 6
              EXPECT_TRUE(entry);
              TrivialInitEntry(entry, (const void*)88);
              initEntryCalled = true;
            });
        EXPECT_FALSE(initEntryCalled);
        EXPECT_EQ(entryHandle.Entry(), entry);

        return entry;
      });
  ASSERT_TRUE(entry2);
  ASSERT_EQ(t.EntryCount(), 1u);

  ASSERT_EQ(entry1, entry2);
}

// 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.
  size_t numInserted = 0;
  while (true) {
    if (!t->Add((const void*)numInserted, mozilla::fallible)) {
      break;
    }
    numInserted++;
  }

  // We stop when the element count is 96.875% of PLDHashTable::kMaxCapacity
  // (see MaxLoadOnGrowthFailure()).
  if (numInserted !=
      PLDHashTable::kMaxCapacity - (PLDHashTable::kMaxCapacity >> 5)) {
    delete t;
    ASSERT_TRUE(false);
  }

  delete t;
}
#endif

Messung V0.5 in Prozent
C=82 H=92 G=86

¤ 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.0.6Bemerkung:  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.