public void try_get_oldest_entry_for_largest_hash_returns_correct_index_entry() { IndexEntry entry; Assert.IsTrue(PTable.TryGetOldestEntry(0x010500000000, out entry)); Assert.AreEqual(GetHash(0x010500000000), entry.Stream); Assert.AreEqual(0, entry.Version); Assert.AreEqual(0x0003, entry.Position); }
public void throw_exception_if_index_entries_not_descending_during_ptable_get_oldest_entry_2(byte version, bool skipIndexVerify) { string ptableFileName = ConstructPTable(version); CorruptPTableFile(ptableFileName, version, "maxOutMiddleEntries"); //loading with a depth of 1 should load only 2 midpoints (first and last index entry) PTable pTable = PTable.FromFile(ptableFileName, 1, skipIndexVerify); IndexEntry entry; Assert.Throws <MaybeCorruptIndexException>(() => pTable.TryGetOldestEntry(GetOriginalHash(numIndexEntries / 2, version), out entry)); pTable.Dispose(); }
public void try_get_oldest_entry_returns_nothing_for_nonexistent_stream() { IndexEntry entry; Assert.IsFalse(PTable.TryGetOldestEntry(0x010200000000, out entry)); }