private long FileHeaderUsage() { int headerLength = _db.GetFileHeader().Length(); int usage = _blockConverter.BlockAlignedBytes(headerLength); FileHeaderVariablePart2 variablePart = (FileHeaderVariablePart2)FieldValue(_db.GetFileHeader (), "_variablePart"); usage += _blockConverter.BlockAlignedBytes(variablePart.MarshalledLength()); _slots.Add(new Db4objects.Db4o.Internal.Slots.Slot(0, headerLength)); _slots.Add(new Db4objects.Db4o.Internal.Slots.Slot(variablePart.Address(), variablePart .MarshalledLength())); return(usage); }
public virtual void TestAllocateSlot() { Slot slot = new Slot(1, 15); _nonBlocked.Free(slot); Slot allocatedSlot = _nonBlocked.AllocateSlot(8); int expectedAllocatedSlotLength = _blockConverter.BlockAlignedBytes(8); Slot expectedSlot = new Slot(1, expectedAllocatedSlotLength); Assert.AreEqual(expectedSlot, allocatedSlot); }
private void AssertAllocateSlot(int freeSlotSize, int requiredSlotSize, int expectedSlotSize ) { Slot slot = new Slot(1, freeSlotSize); _nonBlocked.Free(slot); Slot allocatedSlot = _nonBlocked.AllocateSlot(requiredSlotSize); int expectedAllocatedSlotLength = _blockConverter.BlockAlignedBytes(expectedSlotSize ); Slot expectedSlot = new Slot(1, expectedAllocatedSlotLength); Assert.AreEqual(expectedSlot, allocatedSlot); }